riskscape-plugins 1.0.1
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/README.md +0 -0
- package/dist/riskscape-plugins.css +1 -0
- package/dist/riskscape-plugins.d.ts +235 -0
- package/dist/riskscape-plugins.es.js +2419 -0
- package/dist/riskscape-plugins.umd.js +21 -0
- package/dist/riskscape-search-only.d.ts +189 -0
- package/dist/riskscape-search.css +1 -0
- package/dist/riskscape-search.es.js +1695 -0
- package/dist/riskscape-search.umd.js +6 -0
- package/package.json +59 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function(w,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("leaflet")):typeof define=="function"&&define.amd?define(["exports","leaflet"],v):(w=typeof globalThis<"u"?globalThis:w||self,v(w.RiskscapePlugins={}))})(this,function(w){"use strict";var uo=Object.defineProperty;var dr=w=>{throw TypeError(w)};var po=(w,v,R)=>v in w?uo(w,v,{enumerable:!0,configurable:!0,writable:!0,value:R}):w[v]=R;var T=(w,v,R)=>po(w,typeof v!="symbol"?v+"":v,R),St=(w,v,R)=>v.has(w)||dr("Cannot "+R);var o=(w,v,R)=>(St(w,v,"read from private field"),R?R.call(w):v.get(w)),y=(w,v,R)=>v.has(w)?dr("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(w):v.set(w,R),p=(w,v,R,Le)=>(St(w,v,"write to private field"),Le?Le.call(w,R):v.set(w,R),R),l=(w,v,R)=>(St(w,v,"access private method"),R);var Ge=(w,v,R,Le)=>({set _(yt){p(w,v,yt,R)},get _(){return o(w,v,Le)}});var ne,q,N,oe,we,xe,dt,S,A,_,K,P,Q,de,g,ur,pr,fr,mr,gr,br,yr,wr,Tt,ft,Ve,mt,Ye,Ot,Rt,He,Fe,ut,se,xr,De,ar,O,vr,_r,kr,Er,Ar,Lr,Cr,Ue,Se,We,Be,F,je,Ze,ve,zr,Dt,J,D,X,G,H,ue,$,_e,Te,B,W,c,Mr,Sr,Tr,Or,Rr,Dr,Ur,Pr,Ir,Nr,Hr,Fr,Wr,Br,fe,Ae,ae,jr,Zr,qr,gt,Ut,Qe,Kr,Gr,Vr,Yr,Qr,Jr,Xr,$r,ei,ti,Pt,bt,It,ri,Je,Xe,ii;var v=document.createElement("style");v.textContent=`.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.rs-unit-selector-container{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10000;width:300px;max-width:90vw;background:#fff;border-radius:8px;box-shadow:0 10px 25px #00000026;overflow:hidden}.rs-unit-selector-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem;background:#f8f9fa;border-bottom:1px solid #e5e7eb}.rs-unit-selector-title{font-size:.875rem;font-weight:600;color:#1f2937;margin:0}.rs-unit-selector-cancel{background:none;border:none;color:#6b7280;cursor:pointer;padding:.25rem;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:all .2s ease}.rs-unit-selector-cancel:hover{background:#e5e7eb;color:#374151}.rs-unit-selector-input{width:100%;padding:.75rem 1rem;border:none;border-bottom:1px solid #e5e7eb;font-size:.875rem;background:#fff;outline:none;transition:border-color .2s ease;box-sizing:border-box}.rs-unit-selector-input:focus{border-color:#3b82f6}.rs-unit-selector-input::placeholder{color:#9ca3af}.rs-unit-selector-dropdown{position:relative;background:#fff;max-height:280px;overflow:hidden;display:flex;flex-direction:column}.rs-unit-selector-list{flex:1;overflow-y:auto;margin:0;padding:0;list-style:none;max-height:280px}.rs-unit-selector-item{cursor:pointer;transition:background-color .15s ease;border-bottom:1px solid #f3f4f6;padding:.75rem 1rem;display:flex;align-items:center}.rs-unit-selector-item:last-child{border-bottom:none}.rs-unit-selector-item:hover{background-color:#f9fafb}.rs-unit-selector-item--selected{background-color:#eff6ff;border-color:#dbeafe}.rs-unit-selector-unit-number{font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:.875rem;font-weight:600;color:#1f2937;flex:1}.rs-unit-selector-no-results{padding:1.5rem 1rem;text-align:center;color:#6b7280;font-size:.875rem}@media (max-width: 640px){.rs-unit-selector-container{width:280px}.rs-unit-selector-item{padding:.875rem .75rem}}.rs-unit-selector-list::-webkit-scrollbar{width:8px}.rs-unit-selector-list::-webkit-scrollbar-track{background:#f1f1f1}.rs-unit-selector-list::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}.rs-unit-selector-list::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.rs-unit-selector-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}:root{--rs-unit-selector-primary-color: #3b82f6;--rs-unit-selector-text-color: #1f2937;--rs-unit-selector-text-muted: #6b7280;--rs-unit-selector-border-color: #e5e7eb;--rs-unit-selector-bg-color: #ffffff;--rs-unit-selector-bg-selected: #eff6ff;--rs-unit-selector-bg-hover: #f9fafb;--rs-unit-selector-shadow: 0 10px 25px rgba(0, 0, 0, .15)}.rs-unit-selector-input:focus{border-color:var(--rs-unit-selector-primary-color)}.rs-unit-selector-container{background:var(--rs-unit-selector-bg-color);box-shadow:var(--rs-unit-selector-shadow)}.rs-unit-selector-header,.rs-unit-selector-input{border-color:var(--rs-unit-selector-border-color)}.rs-unit-selector-item--selected{background-color:var(--rs-unit-selector-bg-selected)}.rs-unit-selector-item:hover{background-color:var(--rs-unit-selector-bg-hover)}.rs-unit-selector-unit-number{color:var(--rs-unit-selector-text-color)}.rs-unit-selector-no-results{color:var(--rs-unit-selector-text-muted)}@-webkit-keyframes leaflet-gestures-fadein{0%{opacity:0}to{opacity:1}}@keyframes leaflet-gestures-fadein{0%{opacity:0}to{opacity:1}}.leaflet-container:after{-webkit-animation:leaflet-gestures-fadein .8s backwards;animation:leaflet-gestures-fadein .8s backwards;color:#fff;font-family:Roboto,Arial,sans-serif;font-size:22px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:15px;position:absolute;top:0;left:0;right:0;bottom:0;background:#00000080;z-index:461;pointer-events:none}.leaflet-gesture-handling-touch-warning:after,.leaflet-gesture-handling-scroll-warning:after{-webkit-animation:leaflet-gestures-fadein .8s forwards;animation:leaflet-gestures-fadein .8s forwards}.leaflet-gesture-handling-touch-warning:after{content:attr(data-gesture-handling-touch-content)}.leaflet-gesture-handling-scroll-warning:after{content:attr(data-gesture-handling-scroll-content)}:root{--rs-search-primary-color: #2563eb;--rs-search-secondary-color: #f8fafc;--rs-search-text-color: #333333;--rs-search-muted-color: #6b7280;--rs-search-border-color: #e5e7eb;--rs-search-error-color: #dc2626;--rs-search-success-color: #16a34a;--rs-search-menu-bg: white;--rs-search-menu-color: var(--rs-search-text-color);--rs-search-menu-font-size: .95rem;--rs-search-menu-font-family: inherit;--rs-search-menu-border: 1px solid var(--rs-search-border-color);--rs-search-menu-border-radius: 8px;--rs-search-menu-shadow: 0 4px 10px rgba(0, 0, 0, .1);--rs-search-menu-z-index: 1000;--rs-search-menu-max-height: 400px;--rs-search-item-padding: 10px 16px;--rs-search-item-hover-bg: var(--rs-search-secondary-color);--rs-search-item-selected-bg: var(--rs-search-secondary-color);--rs-search-item-selected-border-left: 3px solid var(--rs-search-primary-color);--rs-search-candidate-font-weight: 500;--rs-search-meta-font-size: .85rem;--rs-search-category-color: var(--rs-search-muted-color);--rs-search-loading-spinner-color: rgba(0, 0, 0, .3);--rs-search-loading-bg: rgba(255, 255, 255, .6);--rs-search-powered-by-bg: #f1f2f3;--rs-search-powered-by-color: #b01d21}@keyframes rs-loading-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rs-loading-pulse{0%,to{opacity:.6}50%{opacity:1}}.rs-search-container{position:absolute;top:0;left:0;z-index:var(--rs-search-menu-z-index);width:max-content;min-width:400px;max-width:480px;display:flex;flex-direction:column;pointer-events:none;filter:drop-shadow(0 4px 10px rgba(0,0,0,.1))}.rs-search-menu{position:relative;display:none;width:100%;max-width:none;max-height:var(--rs-search-menu-max-height);overflow:hidden;overflow-y:auto;-webkit-user-select:none;user-select:none;pointer-events:auto;box-shadow:none;background:var(--rs-search-menu-bg);border:var(--rs-search-menu-border);border-radius:var(--rs-search-menu-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:none;color:var(--rs-search-menu-color);font-family:var(--rs-search-menu-font-family);font-size:var(--rs-search-menu-font-size);font-weight:400;transition:box-shadow .2s ease,opacity .15s ease}@media only screen and (max-width: 479px){.rs-search-container{width:100%;min-width:unset;max-width:100%}.rs-search-results__item{padding:12px}}.rs-search-powered-by{font-size:.75em;text-align:right;padding:8px 12px;background:var(--rs-search-powered-by-bg);border:var(--rs-search-menu-border);border-top:none;border-bottom-left-radius:var(--rs-search-menu-border-radius);border-bottom-right-radius:var(--rs-search-menu-border-radius);width:100%;pointer-events:auto;box-shadow:none;position:relative}.rs-search-powered-by a,.rs-search-powered-by span{color:var(--rs-search-powered-by-color);text-decoration:none;transition:opacity .2s ease}.rs-search-powered-by a:hover{opacity:.8}.rs-search-loading{top:0;left:0;width:100%;height:100%;position:absolute;display:none;flex-direction:row;align-items:center;justify-content:center;background:var(--rs-search-loading-bg, rgba(255, 255, 255, .7));z-index:100;border-radius:var(--rs-search-menu-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;pointer-events:all;gap:8px}.rs-search-loading__spinner{width:16px;height:16px;border:1.5px solid rgba(0,0,0,.08);border-top:1.5px solid var(--rs-search-primary-color, #2563eb);border-radius:50%;animation:rs-loading-spin .7s linear infinite;margin:0;box-shadow:none;flex-shrink:0}.rs-search-loading__text{font-size:13px;color:var(--rs-search-text-color);font-weight:400;opacity:.75;letter-spacing:.01em;margin:0}.rs-search-results{margin:0;padding:0;list-style:none}.rs-search-results__item{cursor:pointer;padding:var(--rs-search-item-padding);line-height:1.5;transition:background-color .15s ease,padding-left .15s ease;position:relative}.rs-search-results__message{padding:var(--rs-search-item-padding);line-height:1.5;text-align:center;color:var(--rs-search-muted-color);display:flex;align-items:center;justify-content:center}.rs-search-results__loading-placeholder{min-height:50px;background:transparent;margin:0;padding:0}.rs-search-results__item+.rs-search-results__item{border-top:var(--rs-search-menu-border)}.rs-search-results__icon{margin-right:10px}.rs-search-results__content{display:flex;flex-direction:column;gap:4px}.rs-search-results__candidate{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--rs-search-text-color);line-height:1.4}.rs-search-results__candidate span{font-weight:var(--rs-search-candidate-font-weight)}.rs-search-results__meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:var(--rs-search-meta-font-size)}.rs-search-results__category{font-weight:500;color:var(--rs-search-category-color);background-color:#0000000d;padding:2px 8px;border-radius:4px;font-size:.8em;display:inline-block}.rs-search-results__description{font-size:.9em;color:var(--rs-search-muted-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rs-search-results__item:hover,.rs-search-results__item--hover{background-color:var(--rs-search-item-hover-bg)}.rs-search-results__item--selected{background-color:var(--rs-search-item-selected-bg);padding-left:calc(var(--rs-search-item-padding-left, 16px) + 3px)}.rs-search-results__item--selected:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background-color:var(--rs-search-primary-color)}.rs-search-results__error{padding:16px;color:var(--rs-search-error-color);background-color:#dc262605;margin:8px;border-radius:6px;max-height:none}.rs-search-results__error-message{display:flex;align-items:center;gap:10px;font-size:.95em}.rs-search-results__error-icon{font-size:18px}.rs-map-container{z-index:1;width:100%;height:100%;position:relative}.rs-map-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#000;z-index:1000;cursor:wait;display:flex;justify-content:center;align-items:center}
|
|
2
|
+
/*$vite$:1*/`,document.head.appendChild(v);const R=L.TileLayer.WMS.extend({initialize:function(r,e,t){this.apiKey=t,L.TileLayer.WMS.prototype.initialize.call(this,r,e)},getTileUrl:function(r){var i;const e=this._tileCoordsToBounds(r).toBBoxString();let t=`${this._url}?key=${this.apiKey}&bbox=${e}`;return(i=this.wmsParams)!=null&&i.cql_filter&&(t+=`&cql_filter=${this.wmsParams.cql_filter}`),t}});L.RiskscapeWmsLayer=R;const Le=L.TileLayer.extend({initialize:function(r,e,t){this.apiKey=t,L.TileLayer.prototype.initialize.call(this,r,e)},getTileUrl:function(r){return`${L.TileLayer.prototype.getTileUrl.call(this,r)}?key=${this.apiKey}`}});L.RiskscapeTileLayer=Le;class yt{constructor(e={}){y(this,g);y(this,ne,[]);y(this,q,[]);y(this,N,-1);y(this,oe,!1);y(this,we,null);y(this,xe,null);y(this,dt,null);y(this,S,null);y(this,A,null);y(this,_,null);y(this,K,null);y(this,P,null);y(this,Q,null);y(this,de,{maxVisibleItems:8,placeholder:"Type to search unit numbers...",noResultsText:"No units found"});p(this,de,{...o(this,de),...e}),l(this,g,ur).call(this),l(this,g,pr).call(this)}show(e,t,i,{onSelect:s,onCancel:a}={}){if(p(this,ne,e||[]),p(this,q,[...o(this,ne)]),p(this,N,-1),p(this,we,s),p(this,xe,a),p(this,S,i),o(this,_).value="",l(this,g,ft).call(this),o(this,S))try{o(this,S).dragging.disable(),o(this,S).touchZoom.disable(),o(this,S).doubleClickZoom.disable(),o(this,S).scrollWheelZoom.disable(),o(this,S).boxZoom.disable(),o(this,S).keyboard.disable(),o(this,S).tap&&o(this,S).tap.disable()}catch(n){console.warn("Could not disable map interactions:",n)}if(t){const n=t.getBoundingClientRect(),h=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;o(this,A).style.position="absolute",o(this,A).style.top=`${n.top+h+n.height/2-50}px`,o(this,A).style.left=`${n.left+d+n.width/2}px`,o(this,A).style.transform="translate(-50%, -50%)",o(this,A).style.zIndex="10000"}document.body.contains(o(this,A))||document.body.appendChild(o(this,A)),l(this,g,mt).call(this),setTimeout(()=>{o(this,_).focus()},100)}isVisible(){return o(this,oe)}getElement(){return o(this,A)}hide(){if(!(!o(this,A)||!document.body.contains(o(this,A)))){if(l(this,g,Ye).call(this),o(this,S))try{o(this,S).dragging.enable(),o(this,S).touchZoom.enable(),o(this,S).doubleClickZoom.enable(),o(this,S).scrollWheelZoom.enable(),o(this,S).boxZoom.enable(),o(this,S).keyboard.enable(),o(this,S).tap&&o(this,S).tap.enable()}catch(e){console.warn("Could not re-enable map interactions:",e)}try{document.body.removeChild(o(this,A))}catch(e){console.warn("Could not remove unit selector from DOM:",e)}p(this,N,-1),p(this,oe,!1),o(this,_).value=""}}destroy(){l(this,g,Ye).call(this);try{if(o(this,_)&&o(this,_).parentNode){const e=o(this,_).cloneNode(!0);o(this,_).parentNode.replaceChild(e,o(this,_))}}catch(e){console.warn("Could not clean up input event listeners:",e)}try{if(o(this,P)&&o(this,P).parentNode){const e=o(this,P).cloneNode(!0);o(this,P).parentNode.replaceChild(e,o(this,P))}}catch(e){console.warn("Could not clean up list event listeners:",e)}try{o(this,A)&&(document.body.contains(o(this,A))&&document.body.removeChild(o(this,A)),o(this,A).parentNode&&o(this,A).parentNode.removeChild(o(this,A)),document.querySelectorAll(".rs-unit-selector-container").forEach(t=>{try{t.parentNode&&t.parentNode.removeChild(t)}catch(i){console.warn("Could not remove orphaned unit selector element:",i)}}))}catch(e){console.warn("Could not remove container during destroy:",e)}try{p(this,ne,[]),p(this,q,[]),p(this,we,null),p(this,xe,null),p(this,S,null),p(this,A,null),p(this,_,null),p(this,K,null),p(this,P,null),p(this,Q,null),p(this,dt,null)}catch(e){console.warn("Could not clear references during destroy:",e)}}}ne=new WeakMap,q=new WeakMap,N=new WeakMap,oe=new WeakMap,we=new WeakMap,xe=new WeakMap,dt=new WeakMap,S=new WeakMap,A=new WeakMap,_=new WeakMap,K=new WeakMap,P=new WeakMap,Q=new WeakMap,de=new WeakMap,g=new WeakSet,ur=function(){p(this,A,document.createElement("div")),o(this,A).className="rs-unit-selector-container";const e=document.createElement("div");e.className="rs-unit-selector-header",e.innerHTML=`
|
|
3
|
+
<span class="rs-unit-selector-title">Select Unit</span>
|
|
4
|
+
<button class="rs-unit-selector-cancel" type="button" aria-label="Cancel">
|
|
5
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
6
|
+
<path d="M12.5 3.5L8 8l4.5 4.5-1 1L7 9l-4.5 4.5-1-1L6 8 1.5 3.5l1-1L7 7l4.5-4.5 1 1z"/>
|
|
7
|
+
</svg>
|
|
8
|
+
</button>
|
|
9
|
+
`,p(this,_,document.createElement("input")),o(this,_).type="text",o(this,_).className="rs-unit-selector-input",o(this,_).placeholder=o(this,de).placeholder,o(this,_).autocomplete="off",o(this,_).spellcheck=!1,o(this,_).setAttribute("role","combobox"),o(this,_).setAttribute("aria-autocomplete","list"),o(this,_).setAttribute("aria-expanded","false"),p(this,K,document.createElement("div")),o(this,K).className="rs-unit-selector-dropdown",o(this,K).style.display="none",p(this,P,document.createElement("ul")),o(this,P).className="rs-unit-selector-list",o(this,P).setAttribute("role","listbox"),p(this,Q,document.createElement("div")),o(this,Q).className="rs-unit-selector-no-results",o(this,Q).textContent=o(this,de).noResultsText,o(this,Q).style.display="none",o(this,K).appendChild(o(this,P)),o(this,K).appendChild(o(this,Q)),o(this,A).appendChild(e),o(this,A).appendChild(o(this,_)),o(this,A).appendChild(o(this,K))},pr=function(){o(this,_).addEventListener("input",l(this,g,fr).bind(this)),o(this,_).addEventListener("keydown",l(this,g,mr).bind(this)),o(this,_).addEventListener("focus",l(this,g,gr).bind(this)),o(this,_).addEventListener("blur",l(this,g,br).bind(this)),o(this,A).querySelector(".rs-unit-selector-cancel").addEventListener("click",l(this,g,Rt).bind(this)),o(this,P).addEventListener("click",l(this,g,yr).bind(this)),o(this,P).addEventListener("mouseover",l(this,g,wr).bind(this))},fr=function(e){const t=e.target.value.trim();l(this,g,Tt).call(this,t),p(this,N,-1),l(this,g,ft).call(this),l(this,g,mt).call(this)},mr=function(e){if(o(this,oe))switch(e.key){case"ArrowDown":e.preventDefault(),p(this,N,Math.min(o(this,N)+1,o(this,q).length-1)),l(this,g,Ve).call(this);break;case"ArrowUp":e.preventDefault(),p(this,N,Math.max(o(this,N)-1,-1)),l(this,g,Ve).call(this);break;case"Enter":e.preventDefault(),o(this,N)>=0&&o(this,q)[o(this,N)]&&l(this,g,Ot).call(this,o(this,q)[o(this,N)]);break;case"Escape":e.preventDefault(),l(this,g,Ye).call(this),l(this,g,Rt).call(this);break}},gr=function(){o(this,ne).length>0&&(l(this,g,Tt).call(this,o(this,_).value.trim()),l(this,g,ft).call(this),l(this,g,mt).call(this))},br=function(e){},yr=function(e){const t=e.target.closest(".rs-unit-selector-item");if(t){const i=parseInt(t.dataset.index),s=o(this,q)[i];s&&l(this,g,Ot).call(this,s)}},wr=function(e){const t=e.target.closest(".rs-unit-selector-item");if(t){const i=parseInt(t.dataset.index);p(this,N,i),l(this,g,Ve).call(this)}},Tt=function(e){e?p(this,q,o(this,ne).filter(t=>t.unit_number.toLowerCase().includes(e.toLowerCase()))):p(this,q,[...o(this,ne)])},ft=function(){if(o(this,q).length===0){o(this,P).style.display="none",o(this,Q).style.display="block";return}o(this,P).style.display="block",o(this,Q).style.display="none";const e=o(this,q).slice(0,o(this,de).maxVisibleItems*2);o(this,P).innerHTML=e.map((t,i)=>`
|
|
10
|
+
<li class="rs-unit-selector-item" data-index="${i}" role="option">
|
|
11
|
+
<span class="rs-unit-selector-unit-number">${t.unit_number}</span>
|
|
12
|
+
</li>
|
|
13
|
+
`).join(""),l(this,g,Ve).call(this)},Ve=function(){const e=o(this,P).querySelectorAll(".rs-unit-selector-item");if(e.forEach((t,i)=>{t.classList.toggle("rs-unit-selector-item--selected",i===o(this,N))}),o(this,N)>=0){const t=e[o(this,N)];t&&t.scrollIntoView({block:"nearest"})}},mt=function(){o(this,oe)||(p(this,oe,!0),o(this,K).style.display="block",o(this,_).setAttribute("aria-expanded","true"))},Ye=function(){o(this,oe)&&(p(this,oe,!1),o(this,K)&&(o(this,K).style.display="none"),o(this,_)&&o(this,_).setAttribute("aria-expanded","false"))},Ot=function(e){o(this,_).value=e.unit_number,l(this,g,Ye).call(this),this.hide(),o(this,we)&&o(this,we).call(this,e)},Rt=function(){this.hide(),o(this,xe)&&o(this,xe).call(this)};let oi=(ar=class{constructor({apiKey:e,baseUrl:t}){y(this,se);y(this,He);y(this,Fe);y(this,ut,8e3);p(this,He,e),p(this,Fe,t)}async fetchAddress(e){return l(this,se,De).call(this,"get","addressing/v2/address",{params:{address_id:e}})}async fetchFeature(e,t){return l(this,se,De).call(this,"get","features/v1/feature",{params:{type:e,...t}})}async fetchProperty(e,t){return l(this,se,De).call(this,"get","properties/v1/property",{params:{property_key:e,unit_number:t}})}async fetchPropertyUnits(e){return l(this,se,De).call(this,"get","properties/v1/unit-numbers",{params:{property_key:e}})}async fetchSchemeUnits(e){return l(this,se,De).call(this,"get","schemes/v1/units",{params:{scheme_id:e}})}},He=new WeakMap,Fe=new WeakMap,ut=new WeakMap,se=new WeakSet,xr=function(e){var i,s;console.error("API call failed:",e.message);const t=new CustomEvent("riskscape-api:error",{detail:{message:e.message,response:(i=e.response)==null?void 0:i.data,status:(s=e.response)==null?void 0:s.status}});throw document.dispatchEvent(t),e},De=async function(e,t,i={}){try{const s=new URL(t,o(this,Fe));i.params&&Object.entries(i.params).forEach(([n,h])=>{h!=null&&s.searchParams.append(n,h)});const a=await fetch(s,{method:e.toUpperCase(),headers:{accept:"application/json","x-api-key":o(this,He),...i.headers},signal:AbortSignal.timeout?AbortSignal.timeout(o(this,ut)):void 0});if(!a.ok){const n=new Error(`HTTP ${a.status}`);throw n.response={status:a.status,data:await a.json().catch(()=>({}))},n}return await a.json()}catch(s){return l(this,se,xr).call(this,s)}},ar);var Pe={exports:{}},si=Pe.exports,Nt;function ni(){return Nt||(Nt=1,function(r,e){(function(t,i){i(e)})(si,function(t){var i={ar:{touch:"استخدم إصبعين لتحريك الخريطة",scroll:"استخدم ctrl + scroll لتصغير/تكبير الخريطة",scrollMac:"يمكنك استخدام ⌘ + التمرير لتكبير/تصغير الخريطة"},bg:{touch:"Използвайте два пръста, за да преместите картата",scroll:"Задръжте бутона Ctrl натиснат, докато превъртате, за да промените мащаба на картата",scrollMac:"Задръжте бутона ⌘ натиснат, докато превъртате, за да промените мащаба на картата"},bn:{touch:"মানচিত্রটিকে সরাতে দুটি আঙ্গুল ব্যবহার করুন",scroll:"ম্যাপ জুম করতে ctrl + scroll ব্যবহার করুন",scrollMac:"ম্যাপে জুম করতে ⌘ বোতাম টিপে স্ক্রল করুন"},ca:{touch:"Fes servir dos dits per moure el mapa",scroll:"Prem la tecla Control mentre et desplaces per apropar i allunyar el mapa",scrollMac:"Prem la tecla ⌘ mentre et desplaces per apropar i allunyar el mapa"},cs:{touch:"K posunutí mapy použijte dva prsty",scroll:"Velikost zobrazení mapy změňte podržením klávesy Ctrl a posouváním kolečka myši",scrollMac:"Velikost zobrazení mapy změníte podržením klávesy ⌘ a posunutím kolečka myši / touchpadu"},da:{touch:"Brug to fingre til at flytte kortet",scroll:"Brug ctrl + rullefunktionen til at zoome ind og ud på kortet",scrollMac:"Brug ⌘ + rullefunktionen til at zoome ind og ud på kortet"},de:{touch:"Verschieben der Karte mit zwei Fingern",scroll:"Verwende Strg+Scrollen zum Zoomen der Karte",scrollMac:"⌘"},el:{touch:"Χρησιμοποιήστε δύο δάχτυλα για μετακίνηση στον χάρτη",scroll:"Χρησιμοποιήστε το πλήκτρο Ctrl και κύλιση, για να μεγεθύνετε τον χάρτη",scrollMac:"Χρησιμοποιήστε το πλήκτρο ⌘ + κύλιση για εστίαση στον χάρτη"},en:{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-AU":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-GB":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},es:{touch:"Para mover el mapa, utiliza dos dedos",scroll:"Mantén pulsada la tecla Ctrl mientras te desplazas para acercar o alejar el mapa",scrollMac:"Mantén pulsada la tecla ⌘ mientras te desplazas para acercar o alejar el mapa"},eu:{touch:"Erabili bi hatz mapa mugitzeko",scroll:"Mapan zooma aplikatzeko, sakatu Ktrl eta egin gora edo behera",scrollMac:"Eduki sakatuta ⌘ eta egin gora eta behera mapa handitu eta txikitzeko"},fa:{touch:"برای حرکت دادن نقشه از دو انگشت استفاده کنید.",scroll:"برای بزرگنمایی نقشه از ctrl + scroll استفاده کنید",scrollMac:"برای بزرگنمایی نقشه، از ⌘ + پیمایش استفاده کنید."},fi:{touch:"Siirrä karttaa kahdella sormella.",scroll:"Zoomaa karttaa painamalla Ctrl-painiketta ja vierittämällä.",scrollMac:"Zoomaa karttaa pitämällä painike ⌘ painettuna ja vierittämällä."},fil:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},fr:{touch:"Utilisez deux doigts pour déplacer la carte",scroll:"Vous pouvez zoomer sur la carte à l'aide de CTRL+Molette de défilement",scrollMac:"Vous pouvez zoomer sur la carte à l'aide de ⌘+Molette de défilement"},gl:{touch:"Utiliza dous dedos para mover o mapa",scroll:"Preme Ctrl mentres te desprazas para ampliar o mapa",scrollMac:"Preme ⌘ e desprázate para ampliar o mapa"},gu:{touch:"નકશો ખસેડવા બે આંગળીઓનો ઉપયોગ કરો",scroll:"નકશાને ઝૂમ કરવા માટે ctrl + સ્ક્રોલનો ઉપયોગ કરો",scrollMac:"નકશાને ઝૂમ કરવા ⌘ + સ્ક્રોલનો ઉપયોગ કરો"},hi:{touch:"मैप एक जगह से दूसरी जगह ले जाने के लिए दो उंगलियों का इस्तेमाल करें",scroll:"मैप को ज़ूम करने के लिए ctrl + स्क्रोल का उपयोग करें",scrollMac:"मैप को ज़ूम करने के लिए ⌘ + स्क्रोल का उपयोग करें"},hr:{touch:"Pomičite kartu pomoću dva prsta",scroll:"Upotrijebite Ctrl i klizač miša da biste zumirali kartu",scrollMac:"Upotrijebite gumb ⌘ dok se pomičete za zumiranje karte"},hu:{touch:"Két ujjal mozgassa a térképet",scroll:"A térkép a ctrl + görgetés használatával nagyítható",scrollMac:"A térkép a ⌘ + görgetés használatával nagyítható"},id:{touch:"Gunakan dua jari untuk menggerakkan peta",scroll:"Gunakan ctrl + scroll untuk memperbesar atau memperkecil peta",scrollMac:"Gunakan ⌘ + scroll untuk memperbesar atau memperkecil peta"},it:{touch:"Utilizza due dita per spostare la mappa",scroll:"Utilizza CTRL + scorrimento per eseguire lo zoom della mappa",scrollMac:"Utilizza ⌘ + scorrimento per eseguire lo zoom della mappa"},iw:{touch:"הזז את המפה באמצעות שתי אצבעות",scroll:"אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ctrl וגלילה",scrollMac:"אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ⌘ וגלילה"},ja:{touch:"地図を移動させるには指 2 本で操作します",scroll:"地図をズームするには、Ctrl キーを押しながらスクロールしてください",scrollMac:"地図をズームするには、⌘ キーを押しながらスクロールしてください"},kn:{touch:"Use two fingers to move the map",scroll:"Use Ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},ko:{touch:"지도를 움직이려면 두 손가락을 사용하세요.",scroll:"지도를 확대/축소하려면 Ctrl을 누른 채 스크롤하세요.",scrollMac:"지도를 확대하려면 ⌘ + 스크롤 사용"},lt:{touch:"Perkelkite žemėlapį dviem pirštais",scroll:"Slinkite nuspaudę klavišą „Ctrl“, kad pakeistumėte žemėlapio mastelį",scrollMac:"Paspauskite klavišą ⌘ ir slinkite, kad priartintumėte žemėlapį"},lv:{touch:"Lai pārvietotu karti, bīdiet to ar diviem pirkstiem",scroll:"Kartes tālummaiņai izmantojiet ctrl + ritināšanu",scrollMac:"Lai veiktu kartes tālummaiņu, izmantojiet ⌘ + ritināšanu"},ml:{touch:"മാപ്പ് നീക്കാൻ രണ്ട് വിരലുകൾ ഉപയോഗിക്കുക",scroll:"കൺട്രോൾ + സ്ക്രോൾ ഉപയോഗിച്ച് മാപ്പ് സൂം ചെയ്യുക",scrollMac:"⌘ + സ്ക്രോൾ ഉപയോഗിച്ച് മാപ്പ് സൂം ചെയ്യുക"},mr:{touch:"नकाशा हलविण्यासाठी दोन बोटे वापरा",scroll:"नकाशा झूम करण्यासाठी ctrl + scroll वापरा",scrollMac:"नकाशावर झूम करण्यासाठी ⌘ + स्क्रोल वापरा"},nl:{touch:"Gebruik twee vingers om de kaart te verplaatsen",scroll:"Gebruik Ctrl + scrollen om in- en uit te zoomen op de kaart",scrollMac:"Gebruik ⌘ + scrollen om in en uit te zoomen op de kaart"},no:{touch:"Bruk to fingre for å flytte kartet",scroll:"Hold ctrl-tasten inne og rull for å zoome på kartet",scrollMac:"Hold inne ⌘-tasten og rull for å zoome på kartet"},pl:{touch:"Przesuń mapę dwoma palcami",scroll:"Naciśnij CTRL i przewiń, by przybliżyć mapę",scrollMac:"Naciśnij ⌘ i przewiń, by przybliżyć mapę"},pt:{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-BR":{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-PT":{touch:"Utilize dois dedos para mover o mapa",scroll:"Utilizar ctrl + deslocar para aumentar/diminuir zoom do mapa",scrollMac:"Utilize ⌘ + deslocar para aumentar/diminuir o zoom do mapa"},ro:{touch:"Folosiți două degete pentru a deplasa harta",scroll:"Apăsați tasta ctrl și derulați simultan pentru a mări harta",scrollMac:"Folosiți ⌘ și derulați pentru a mări/micșora harta"},ru:{touch:"Чтобы переместить карту, проведите по ней двумя пальцами",scroll:"Чтобы изменить масштаб, прокручивайте карту, удерживая клавишу Ctrl.",scrollMac:"Чтобы изменить масштаб, нажмите ⌘ + прокрутка"},sk:{touch:"Mapu môžete posunúť dvoma prstami",scroll:"Ak chcete priblížiť mapu, stlačte kláves ctrl a posúvajte",scrollMac:"Ak chcete priblížiť mapu, stlačte kláves ⌘ a posúvajte kolieskom myši"},sl:{touch:"Premaknite zemljevid z dvema prstoma",scroll:"Zemljevid povečate tako, da držite tipko Ctrl in vrtite kolesce na miški",scrollMac:"Uporabite ⌘ + funkcijo pomika, da povečate ali pomanjšate zemljevid"},sr:{touch:"Мапу померајте помоћу два прста",scroll:"Притисните ctrl тастер док померате да бисте зумирали мапу",scrollMac:"Притисните тастер ⌘ док померате да бисте зумирали мапу"},sv:{touch:"Använd två fingrar för att flytta kartan",scroll:"Använd ctrl + rulla för att zooma kartan",scrollMac:"Använd ⌘ + rulla för att zooma på kartan"},ta:{touch:"மேப்பை நகர்த்த இரண்டு விரல்களைப் பயன்படுத்தவும்",scroll:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ctrl பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்",scrollMac:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ⌘ பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்"},te:{touch:"మ్యాప్ని తరలించడం కోసం రెండు వేళ్లను ఉపయోగించండి",scroll:"మ్యాప్ని జూమ్ చేయడానికి ctrl బటన్ను నొక్కి ఉంచి, స్క్రోల్ చేయండి",scrollMac:"మ్యాప్ జూమ్ చేయాలంటే ⌘ + స్క్రోల్ ఉపయోగించండి"},th:{touch:"ใช้ 2 นิ้วเพื่อเลื่อนแผนที่",scroll:"กด Ctrl ค้างไว้ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่",scrollMac:"กด ⌘ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่"},tl:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},tr:{touch:"Haritada gezinmek için iki parmağınızı kullanın",scroll:"Haritayı yakınlaştırmak için ctrl + kaydırma kombinasyonunu kullanın",scrollMac:"Haritayı yakınlaştırmak için ⌘ tuşuna basıp ekranı kaydırın"},uk:{touch:"Переміщуйте карту двома пальцями",scroll:"Щоб змінювати масштаб карти, прокручуйте коліщатко миші, утримуючи клавішу Ctrl",scrollMac:"Щоб змінити масштаб карти, використовуйте ⌘ + прокручування"},vi:{touch:"Sử dụng hai ngón tay để di chuyển bản đồ",scroll:"Sử dụng ctrl + cuộn để thu phóng bản đồ",scrollMac:"Sử dụng ⌘ + cuộn để thu phóng bản đồ"},"zh-CN":{touch:"使用双指移动地图",scroll:"按住 Ctrl 并滚动鼠标滚轮才可缩放地图",scrollMac:"按住 ⌘ 并滚动鼠标滚轮才可缩放地图"},"zh-TW":{touch:"同時以兩指移動地圖",scroll:"按住 ctrl 鍵加上捲動滑鼠可以縮放地圖",scrollMac:"按 ⌘ 加上滾動捲軸可以縮放地圖"}};L.Map.mergeOptions({gestureHandlingOptions:{text:{},duration:1e3}});var s=!1,a=L.Handler.extend({addHooks:function(){this._handleTouch=this._handleTouch.bind(this),this._setupPluginOptions(),this._setLanguageContent(),this._disableInteractions(),this._map._container.addEventListener("touchstart",this._handleTouch),this._map._container.addEventListener("touchmove",this._handleTouch),this._map._container.addEventListener("touchend",this._handleTouch),this._map._container.addEventListener("touchcancel",this._handleTouch),this._map._container.addEventListener("click",this._handleTouch),L.DomEvent.on(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.on(this._map,"mouseover",this._handleMouseOver,this),L.DomEvent.on(this._map,"mouseout",this._handleMouseOut,this),L.DomEvent.on(this._map,"movestart",this._handleDragging,this),L.DomEvent.on(this._map,"move",this._handleDragging,this),L.DomEvent.on(this._map,"moveend",this._handleDragging,this)},removeHooks:function(){this._enableInteractions(),this._map._container.removeEventListener("touchstart",this._handleTouch),this._map._container.removeEventListener("touchmove",this._handleTouch),this._map._container.removeEventListener("touchend",this._handleTouch),this._map._container.removeEventListener("touchcancel",this._handleTouch),this._map._container.removeEventListener("click",this._handleTouch),L.DomEvent.off(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.off(this._map,"mouseover",this._handleMouseOver,this),L.DomEvent.off(this._map,"mouseout",this._handleMouseOut,this),L.DomEvent.off(this._map,"movestart",this._handleDragging,this),L.DomEvent.off(this._map,"move",this._handleDragging,this),L.DomEvent.off(this._map,"moveend",this._handleDragging,this)},_handleDragging:function(n){n.type=="movestart"||n.type=="move"?s=!0:n.type=="moveend"&&(s=!1)},_disableInteractions:function(){this._map.dragging.disable(),this._map.scrollWheelZoom.disable(),this._map.tap&&this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable(),this._map.scrollWheelZoom.enable(),this._map.tap&&this._map.tap.enable()},_setupPluginOptions:function(){this._map.options.gestureHandlingText&&(this._map.options.gestureHandlingOptions.text=this._map.options.gestureHandlingText)},_setLanguageContent:function(){var n;if(this._map.options.gestureHandlingOptions&&this._map.options.gestureHandlingOptions.text&&this._map.options.gestureHandlingOptions.text.touch&&this._map.options.gestureHandlingOptions.text.scroll&&this._map.options.gestureHandlingOptions.text.scrollMac)n=this._map.options.gestureHandlingOptions.text;else{var h=this._getUserLanguage();h||(h="en"),i[h]&&(n=i[h]),n||h.indexOf("-")===-1||(h=h.split("-")[0],n=i[h]),n||(n=i[h="en"])}var d=!1;0<=navigator.platform.toUpperCase().indexOf("MAC")&&(d=!0);var u=n.scroll;d&&(u=n.scrollMac),this._map._container.setAttribute("data-gesture-handling-touch-content",n.touch),this._map._container.setAttribute("data-gesture-handling-scroll-content",u)},_getUserLanguage:function(){return navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage},_handleTouch:function(n){for(var h=["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"],d=!1,u=0;u<h.length;u++)L.DomUtil.hasClass(n.target,h[u])&&(d=!0);d?L.DomUtil.hasClass(n.target,"leaflet-interactive")&&n.type==="touchmove"&&n.touches.length===1?(L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-touch-warning"),this._disableInteractions()):L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning"):n.type==="touchmove"||n.type==="touchstart"?n.touches.length===1?(L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-touch-warning"),this._disableInteractions()):(n.preventDefault(),this._enableInteractions(),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning")):L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning")},_isScrolling:!1,_handleScroll:function(n){n.metaKey||n.ctrlKey?(n.preventDefault(),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-scroll-warning"),this._map.scrollWheelZoom.enable()):(L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-scroll-warning"),this._map.scrollWheelZoom.disable(),clearTimeout(this._isScrolling),this._isScrolling=setTimeout(function(){for(var h=document.getElementsByClassName("leaflet-gesture-handling-scroll-warning"),d=0;d<h.length;d++)L.DomUtil.removeClass(h[d],"leaflet-gesture-handling-scroll-warning")},this._map.options.gestureHandlingOptions.duration))},_handleMouseOver:function(n){this._enableInteractions()},_handleMouseOut:function(n){s||this._disableInteractions()}});L.Map.addInitHook("addHandler","gestureHandling",a),t.GestureHandling=a,t.default=a,Object.defineProperty(t,"__esModule",{value:!0})})}(Pe,Pe.exports)),Pe.exports}ni();const ai=r=>`/maps/v1/${r}/{z}/{x}/{y}`,$e=r=>`/tiles/v1/${r}`,li={default:[{name:"base",type:"RiskscapeTileLayer",layerUrl:ai("default"),layerOptions:{pane:"tilePane",zIndex:4,maxZoom:20,tileSize:512,zoomOffset:-1,crossOrigin:!0}},{name:"wmsDefault",type:"RiskscapeWmsLayer",layerUrl:$e("default"),layerOptions:{pane:"tilePane",zIndex:2,minZoom:12,maxZoom:20,tileSize:512,zoomOffset:-1}},{name:"wmsDefaultLabels",type:"RiskscapeWmsLayer",layerUrl:$e("default-labels"),layerOptions:{pane:"overlayPane",zIndex:10,minZoom:13,maxZoom:20,tileSize:512,zoomOffset:-1}}],hybrid:[{name:"googleSatellite",type:"GoogleMutant",layerOptions:{type:"satellite"}},{name:"wmsHybrid",type:"RiskscapeWmsLayer",layerUrl:$e("hybrid"),layerOptions:{pane:"tilePane",zIndex:1,minZoom:5,maxZoom:20,tileSize:512,zoomOffset:-1}},{name:"wmsHybridLabels",type:"RiskscapeWmsLayer",layerUrl:$e("hybrid-labels"),layerOptions:{pane:"overlayPane",minZoom:5,maxZoom:20,tileSize:512,zoomOffset:-1}}]};function ci(r){return li[r]}function hi(r){return{lat:r.lat.toFixed(6),lon:r.lng.toFixed(6)}}function di(r){const e=hi(r);return`${e.lat},${e.lon}`}class wt extends L.Map{constructor(t){let i=t==null?void 0:t.key;if(!i)throw new Error("API key is required.");let s=t.element,a=t.options;const n=(t==null?void 0:t.style)||"default",h=t==null?void 0:t.googleKey;if(n==="hybrid"&&!h)throw new Error("Google API key is required for hybrid style.");let d={key:i,googleKey:h,url:(t==null?void 0:t.url)||"https://api.cloud.riskscape.pro",style:n,featureStyle:(t==null?void 0:t.featureStyle)||{weight:2,color:"white",fillColor:"#1E88E5",fillOpacity:.3},locationFeatureStyle:(t==null?void 0:t.locationFeatureStyle)||{weight:3,color:"#1E88E5",fill:!1,dashArray:"15,5"},operationMode:(t==null?void 0:t.operationMode)||"default"};if(a={...{zoom:5,center:[-29.15,25.15],minZoom:5,maxZoom:20,gestureHandling:!0},...a},a.maxZoom>20)throw new Error("Max zoom level cannot be greater than 20.");super(s,a);y(this,O);T(this,"_api");T(this,"_search");T(this,"_searchMarker");T(this,"_unitSelector");T(this,"_loading",!1);T(this,"_locationFeature");T(this,"_handleMapClick",async t=>{this.getZoom()<=15||await l(this,O,Ue).call(this,"property_scheme",t.latlng)});T(this,"_handleSearchSelect",async({candidate:t})=>{this._removeSearchMarker(),this._removeLocationFeature();const{category:i,subcategory:s,position:a,attributes:n}=t,h=[a.lat,a.lon];if(this.pluginOptions.operationMode==="identify"){if(i==="StreetAddress"){if(s==="StreetNumberScheme"){await l(this,O,Ue).call(this,"scheme",{id:n.scheme_id});return}if(s==="SchemeUnit"){await l(this,O,Ue).call(this,"scheme",{id:n.scheme_id},{unit_number:t.attributes.unit_number,property_key:t.attributes.property_key});return}if(!n.property_key){this._setSearchMarker(h);return}await l(this,O,Ue).call(this,"property",{id:n.property_key});return}if(i==="Scheme"&&s!=="Commercial"){await l(this,O,Ue).call(this,"scheme",{id:n.scheme_id});return}}if(i==="Location"){const d=await this._getFeature("location",{id:n.location_id});this._setLocationFeature(d);return}this._setSearchMarker(h)});this._api=new oi({apiKey:d.key,baseUrl:d.url}),this._unitSelector=new yt({placeholder:"Type to search unit numbers..."}),this.pluginOptions=d,this.styleLayers={},l(this,O,vr).call(this).catch(b=>{console.error("Failed to setup map:",b)})}_withLatLonParams(t){const i={...t};return i!=null&&i.lng&&(i.latlon=di(i),delete i.lat,delete i.lng),i}async _getFeature(t,i){if(!this._loading){this._loading=!0;try{const{data:s}=await this._api.fetchFeature(t,this._withLatLonParams(i));return s}catch(s){console.error("Failed to fetch feature:",s)}finally{this._loading=!1}}}_setLocationFeature(t){this._removeLocationFeature(),t&&(this._locationFeature=L.geoJSON(t,{style:this.pluginOptions.locationFeatureStyle}).addTo(this),this.fitBounds(this._locationFeature.getBounds()))}_removeLocationFeature(){var t;(t=this._locationFeature)==null||t.remove()}_setSearchMarker(t){this._searchMarker=L.marker(t).addTo(this);const i=this.getZoom();this.setView(t,i>=17?i:17)}_removeSearchMarker(){var t;(t=this._searchMarker)==null||t.remove()}bindSearch(t,i){this._search=t,this._search.bindToMap(),this._search.on("select",this._handleSearchSelect.bind(this))}async setStyle(t){const i=ci(t);if(!i)throw new Error(`Style "${t}" is not valid.`);if(t==="hybrid"&&!this.pluginOptions.googleKey)throw new Error("Google API key is required for hybrid style.");for(const s in this.styleLayers)this.removeLayer(this.styleLayers[s]);for(const s of i){let a=null;if(s.type!=="GoogleMutant"){const n=L[s.type];if(!n)throw new Error(`Layer type "${s.type}" is not valid.`);a=new n(this.pluginOptions.url+s.layerUrl,s.layerOptions,this.pluginOptions.key)}a&&(this.styleLayers[s.name]=a.addTo(this))}this.pluginOptions.style=t}setOperationMode(t){this.off("click"),this.pluginOptions.operationMode=t,t==="identify"&&this.on("click",this._handleMapClick.bind(this))}enableInteraction(){this.dragging.enable(),this.touchZoom.enable(),this.doubleClickZoom.enable(),this.scrollWheelZoom.enable(),this.boxZoom.enable(),this.keyboard.enable(),this.tap&&this.tap.enable()}disableInteraction(){this.dragging.disable(),this.touchZoom.disable(),this.doubleClickZoom.disable(),this.scrollWheelZoom.disable(),this.boxZoom.disable(),this.keyboard.disable(),this.tap&&this.tap.disable()}unbindSearch(){this._search&&(this._search.off("select",this._handleSearchSelect),this._search.unbindFromMap(),this._search=null)}destroy(){this._unitSelector&&(this._unitSelector=null),this.unbindSearch()}}O=new WeakSet,vr=async function(){try{await this.setStyle(this.pluginOptions.style)}catch(t){console.error("Failed to set map style:",t),this.pluginOptions.style==="hybrid"&&(console.warn("Falling back to default style"),this.pluginOptions.style="default",await this.setStyle("default"))}this.zoomControl&&this.zoomControl.setPosition("bottomright"),this.attributionControl&&this.attributionControl.setPrefix(`
|
|
14
|
+
Powered by <a href="https://riskscape.pro/powered-by" target="_blank" style="color: #b01d21 !important;">Riskscape</a>
|
|
15
|
+
| © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors
|
|
16
|
+
`),this.setOperationMode(this.pluginOptions.operationMode)},_r=async function(t){return t.type==="scheme"?await l(this,O,Er).call(this,t.scheme_id):t.type==="property"?await l(this,O,kr).call(this,t.property_key):null},kr=async function(t){const{data:i}=await this._api.fetchPropertyUnits(t);return i.map(s=>({unit_number:s,property_key:t}))},Er=async function(t){const{data:i}=await this._api.fetchSchemeUnits(t);return i},Ar=function(t,i={}){l(this,O,Lr).call(this),i!=null&&i.style||(i.style=this.pluginOptions.featureStyle),this.feature=t,this.featureLayer=L.geoJSON(this.feature,i),this.featureLayer.addTo(this)},Lr=function(){var t;(t=this.featureLayer)==null||t.remove(),this.feature=null,this.featureLayer=null},Cr=function(){this.fitBounds(this.featureLayer.getBounds(),{padding:[50,50],minZoom:12})},Ue=async function(t,i,s={}){const a=await this._getFeature(t,i);if(!a)return;l(this,O,Ar).call(this,a),l(this,O,Cr).call(this);let n=(a==null?void 0:a.properties)||{};if(n={...n,...s},n!=null&&n.has_sectional_units&&!(n!=null&&n.unit_number)){const h=await l(this,O,_r).call(this,n);this._unitSelector.show(h,this.getContainer(),this,{onSelect:d=>{this.fire("property:identified",{property:{unit_number:d.unit_number,property_key:d.property_key,address_id:n.address_id}})},onCancel:()=>{}});return}this.fire("property:identified",{property:{unit_number:n.unit_number||"00000",property_key:n.property_key,address_id:n.address_id}})};function ui(r){return/^[A-Z0-9]{8}[0-9]{13}$/.test(r)}function pi(r){return/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?((180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?))$/.test(r)}const et={API_TIMEOUT:5e3,DEFAULT_MIN_CHARS:5,DEFAULT_MAX_RESULTS:10,DEFAULT_DEBOUNCE_TIME:400},Ht={MISSING_ELEMENT:'Configuration error: "element" id is required',ELEMENT_NOT_FOUND:r=>`Element with id "${r}" not found`,API_KEY_REQUIRED:"API Key is required",UNAUTHORIZED:"Authentication error. Please check your API key.",NETWORK_ERROR:"Network error. Please check your connection and try again.",GENERIC_ERROR:"An error occurred while searching. Please try again.",NO_RESULTS:r=>"No results found. Try a different search term."};function fi(r){return{all:r=r||new Map,on:function(e,t){var i=r.get(e);i?i.push(t):r.set(e,[t])},off:function(e,t){var i=r.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var i=r.get(e);i&&i.slice().map(function(s){s(t)}),(i=r.get("*"))&&i.slice().map(function(s){s(e,t)})}}}function mi(r,e){let t;return function(...s){const a=()=>{clearTimeout(t),r.apply(this,s)};clearTimeout(t),t=setTimeout(a,e)}}function Ft(r){return r?r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()):""}function Wt(r,e){return!r||!e?!1:r.toLowerCase().startsWith(e.toLowerCase())}const tt=Math.min,me=Math.max,rt=Math.round,it=Math.floor,te=r=>({x:r,y:r}),gi={left:"right",right:"left",bottom:"top",top:"bottom"},bi={start:"end",end:"start"};function Bt(r,e,t){return me(r,tt(e,t))}function ot(r,e){return typeof r=="function"?r(e):r}function ge(r){return r.split("-")[0]}function st(r){return r.split("-")[1]}function jt(r){return r==="x"?"y":"x"}function Zt(r){return r==="y"?"height":"width"}const yi=new Set(["top","bottom"]);function le(r){return yi.has(ge(r))?"y":"x"}function qt(r){return jt(le(r))}function wi(r,e,t){t===void 0&&(t=!1);const i=st(r),s=qt(r),a=Zt(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(n=nt(n)),[n,nt(n)]}function xi(r){const e=nt(r);return[xt(r),e,xt(e)]}function xt(r){return r.replace(/start|end/g,e=>bi[e])}const Kt=["left","right"],Gt=["right","left"],vi=["top","bottom"],_i=["bottom","top"];function ki(r,e,t){switch(r){case"top":case"bottom":return t?e?Gt:Kt:e?Kt:Gt;case"left":case"right":return e?vi:_i;default:return[]}}function Ei(r,e,t,i){const s=st(r);let a=ki(ge(r),t==="start",i);return s&&(a=a.map(n=>n+"-"+s),e&&(a=a.concat(a.map(xt)))),a}function nt(r){return r.replace(/left|right|bottom|top/g,e=>gi[e])}function Ai(r){return{top:0,right:0,bottom:0,left:0,...r}}function Li(r){return typeof r!="number"?Ai(r):{top:r,right:r,bottom:r,left:r}}function at(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Vt(r,e,t){let{reference:i,floating:s}=r;const a=le(e),n=qt(e),h=Zt(n),d=ge(e),u=a==="y",b=i.x+i.width/2-s.width/2,f=i.y+i.height/2-s.height/2,x=i[h]/2-s[h]/2;let m;switch(d){case"top":m={x:b,y:i.y-s.height};break;case"bottom":m={x:b,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:f};break;case"left":m={x:i.x-s.width,y:f};break;default:m={x:i.x,y:i.y}}switch(st(e)){case"start":m[n]-=x*(t&&u?-1:1);break;case"end":m[n]+=x*(t&&u?-1:1);break}return m}const Ci=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:a=[],platform:n}=t,h=a.filter(Boolean),d=await(n.isRTL==null?void 0:n.isRTL(e));let u=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:b,y:f}=Vt(u,i,d),x=i,m={},k=0;for(let C=0;C<h.length;C++){const{name:z,fn:E}=h[C],{x:M,y:U,data:j,reset:I}=await E({x:b,y:f,initialPlacement:i,placement:x,strategy:s,middlewareData:m,rects:u,platform:n,elements:{reference:r,floating:e}});b=M??b,f=U??f,m={...m,[z]:{...m[z],...j}},I&&k<=50&&(k++,typeof I=="object"&&(I.placement&&(x=I.placement),I.rects&&(u=I.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):I.rects),{x:b,y:f}=Vt(u,x,d)),C=-1)}return{x:b,y:f,placement:x,strategy:s,middlewareData:m}};async function Yt(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:a,rects:n,elements:h,strategy:d}=r,{boundary:u="clippingAncestors",rootBoundary:b="viewport",elementContext:f="floating",altBoundary:x=!1,padding:m=0}=ot(e,r),k=Li(m),z=h[x?f==="floating"?"reference":"floating":f],E=at(await a.getClippingRect({element:(t=await(a.isElement==null?void 0:a.isElement(z)))==null||t?z:z.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(h.floating)),boundary:u,rootBoundary:b,strategy:d})),M=f==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,U=await(a.getOffsetParent==null?void 0:a.getOffsetParent(h.floating)),j=await(a.isElement==null?void 0:a.isElement(U))?await(a.getScale==null?void 0:a.getScale(U))||{x:1,y:1}:{x:1,y:1},I=at(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:M,offsetParent:U,strategy:d}):M);return{top:(E.top-I.top+k.top)/j.y,bottom:(I.bottom-E.bottom+k.bottom)/j.y,left:(E.left-I.left+k.left)/j.x,right:(I.right-E.right+k.right)/j.x}}const zi=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:a,rects:n,initialPlacement:h,platform:d,elements:u}=e,{mainAxis:b=!0,crossAxis:f=!0,fallbackPlacements:x,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:C=!0,...z}=ot(r,e);if((t=a.arrow)!=null&&t.alignmentOffset)return{};const E=ge(s),M=le(h),U=ge(h)===h,j=await(d.isRTL==null?void 0:d.isRTL(u.floating)),I=x||(U||!C?[nt(h)]:xi(h)),qe=k!=="none";!x&&qe&&I.push(...Ei(h,C,k,j));const Oe=[h,...I],zt=await Yt(e,z),pt=[];let Re=((i=a.flip)==null?void 0:i.overflows)||[];if(b&&pt.push(zt[E]),f){const ke=wi(s,n,j);pt.push(zt[ke[0]],zt[ke[1]])}if(Re=[...Re,{placement:s,overflows:pt}],!pt.every(ke=>ke<=0)){var lr,cr;const ke=(((lr=a.flip)==null?void 0:lr.index)||0)+1,Mt=Oe[ke];if(Mt&&(!(f==="alignment"?M!==le(Mt):!1)||Re.every(ee=>ee.overflows[0]>0&&le(ee.placement)===M)))return{data:{index:ke,overflows:Re},reset:{placement:Mt}};let Ke=(cr=Re.filter(Ee=>Ee.overflows[0]<=0).sort((Ee,ee)=>Ee.overflows[1]-ee.overflows[1])[0])==null?void 0:cr.placement;if(!Ke)switch(m){case"bestFit":{var hr;const Ee=(hr=Re.filter(ee=>{if(qe){const pe=le(ee.placement);return pe===M||pe==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(pe=>pe>0).reduce((pe,ho)=>pe+ho,0)]).sort((ee,pe)=>ee[1]-pe[1])[0])==null?void 0:hr[0];Ee&&(Ke=Ee);break}case"initialPlacement":Ke=h;break}if(s!==Ke)return{reset:{placement:Ke}}}return{}}}},Mi=new Set(["left","top"]);async function Si(r,e){const{placement:t,platform:i,elements:s}=r,a=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=ge(t),h=st(t),d=le(t)==="y",u=Mi.has(n)?-1:1,b=a&&d?-1:1,f=ot(e,r);let{mainAxis:x,crossAxis:m,alignmentAxis:k}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return h&&typeof k=="number"&&(m=h==="end"?k*-1:k),d?{x:m*b,y:x*u}:{x:x*u,y:m*b}}const Ti=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:a,placement:n,middlewareData:h}=e,d=await Si(e,r);return n===((t=h.offset)==null?void 0:t.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:n}}}}},Oi=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:a=!0,crossAxis:n=!1,limiter:h={fn:z=>{let{x:E,y:M}=z;return{x:E,y:M}}},...d}=ot(r,e),u={x:t,y:i},b=await Yt(e,d),f=le(ge(s)),x=jt(f);let m=u[x],k=u[f];if(a){const z=x==="y"?"top":"left",E=x==="y"?"bottom":"right",M=m+b[z],U=m-b[E];m=Bt(M,m,U)}if(n){const z=f==="y"?"top":"left",E=f==="y"?"bottom":"right",M=k+b[z],U=k-b[E];k=Bt(M,k,U)}const C=h.fn({...e,[x]:m,[f]:k});return{...C,data:{x:C.x-t,y:C.y-i,enabled:{[x]:a,[f]:n}}}}}};function lt(){return typeof window<"u"}function Ce(r){return Qt(r)?(r.nodeName||"").toLowerCase():"#document"}function Z(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function re(r){var e;return(e=(Qt(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Qt(r){return lt()?r instanceof Node||r instanceof Z(r).Node:!1}function V(r){return lt()?r instanceof Element||r instanceof Z(r).Element:!1}function ie(r){return lt()?r instanceof HTMLElement||r instanceof Z(r).HTMLElement:!1}function Jt(r){return!lt()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Z(r).ShadowRoot}const Ri=new Set(["inline","contents"]);function Ie(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=Y(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Ri.has(s)}const Di=new Set(["table","td","th"]);function Ui(r){return Di.has(Ce(r))}const Pi=[":popover-open",":modal"];function ct(r){return Pi.some(e=>{try{return r.matches(e)}catch{return!1}})}const Ii=["transform","translate","scale","rotate","perspective"],Ni=["transform","translate","scale","rotate","perspective","filter"],Hi=["paint","layout","strict","content"];function vt(r){const e=_t(),t=V(r)?Y(r):r;return Ii.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Ni.some(i=>(t.willChange||"").includes(i))||Hi.some(i=>(t.contain||"").includes(i))}function Fi(r){let e=ce(r);for(;ie(e)&&!ze(e);){if(vt(e))return e;if(ct(e))return null;e=ce(e)}return null}function _t(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Wi=new Set(["html","body","#document"]);function ze(r){return Wi.has(Ce(r))}function Y(r){return Z(r).getComputedStyle(r)}function ht(r){return V(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function ce(r){if(Ce(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Jt(r)&&r.host||re(r);return Jt(e)?e.host:e}function Xt(r){const e=ce(r);return ze(e)?r.ownerDocument?r.ownerDocument.body:r.body:ie(e)&&Ie(e)?e:Xt(e)}function Ne(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=Xt(r),a=s===((i=r.ownerDocument)==null?void 0:i.body),n=Z(s);if(a){const h=kt(n);return e.concat(n,n.visualViewport||[],Ie(s)?s:[],h&&t?Ne(h):[])}return e.concat(s,Ne(s,[],t))}function kt(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function $t(r){const e=Y(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ie(r),a=s?r.offsetWidth:t,n=s?r.offsetHeight:i,h=rt(t)!==a||rt(i)!==n;return h&&(t=a,i=n),{width:t,height:i,$:h}}function Et(r){return V(r)?r:r.contextElement}function Me(r){const e=Et(r);if(!ie(e))return te(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:a}=$t(e);let n=(a?rt(t.width):t.width)/i,h=(a?rt(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!h||!Number.isFinite(h))&&(h=1),{x:n,y:h}}const Bi=te(0);function er(r){const e=Z(r);return!_t()||!e.visualViewport?Bi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ji(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==Z(r)?!1:e}function be(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),a=Et(r);let n=te(1);e&&(i?V(i)&&(n=Me(i)):n=Me(r));const h=ji(a,t,i)?er(a):te(0);let d=(s.left+h.x)/n.x,u=(s.top+h.y)/n.y,b=s.width/n.x,f=s.height/n.y;if(a){const x=Z(a),m=i&&V(i)?Z(i):i;let k=x,C=kt(k);for(;C&&i&&m!==k;){const z=Me(C),E=C.getBoundingClientRect(),M=Y(C),U=E.left+(C.clientLeft+parseFloat(M.paddingLeft))*z.x,j=E.top+(C.clientTop+parseFloat(M.paddingTop))*z.y;d*=z.x,u*=z.y,b*=z.x,f*=z.y,d+=U,u+=j,k=Z(C),C=kt(k)}}return at({width:b,height:f,x:d,y:u})}function At(r,e){const t=ht(r).scrollLeft;return e?e.left+t:be(re(r)).left+t}function tr(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:At(r,i)),a=i.top+e.scrollTop;return{x:s,y:a}}function Zi(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const a=s==="fixed",n=re(i),h=e?ct(e.floating):!1;if(i===n||h&&a)return t;let d={scrollLeft:0,scrollTop:0},u=te(1);const b=te(0),f=ie(i);if((f||!f&&!a)&&((Ce(i)!=="body"||Ie(n))&&(d=ht(i)),ie(i))){const m=be(i);u=Me(i),b.x=m.x+i.clientLeft,b.y=m.y+i.clientTop}const x=n&&!f&&!a?tr(n,d,!0):te(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-d.scrollLeft*u.x+b.x+x.x,y:t.y*u.y-d.scrollTop*u.y+b.y+x.y}}function qi(r){return Array.from(r.getClientRects())}function Ki(r){const e=re(r),t=ht(r),i=r.ownerDocument.body,s=me(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),a=me(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+At(r);const h=-t.scrollTop;return Y(i).direction==="rtl"&&(n+=me(e.clientWidth,i.clientWidth)-s),{width:s,height:a,x:n,y:h}}function Gi(r,e){const t=Z(r),i=re(r),s=t.visualViewport;let a=i.clientWidth,n=i.clientHeight,h=0,d=0;if(s){a=s.width,n=s.height;const u=_t();(!u||u&&e==="fixed")&&(h=s.offsetLeft,d=s.offsetTop)}return{width:a,height:n,x:h,y:d}}const Vi=new Set(["absolute","fixed"]);function Yi(r,e){const t=be(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,a=ie(r)?Me(r):te(1),n=r.clientWidth*a.x,h=r.clientHeight*a.y,d=s*a.x,u=i*a.y;return{width:n,height:h,x:d,y:u}}function rr(r,e,t){let i;if(e==="viewport")i=Gi(r,t);else if(e==="document")i=Ki(re(r));else if(V(e))i=Yi(e,t);else{const s=er(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return at(i)}function ir(r,e){const t=ce(r);return t===e||!V(t)||ze(t)?!1:Y(t).position==="fixed"||ir(t,e)}function Qi(r,e){const t=e.get(r);if(t)return t;let i=Ne(r,[],!1).filter(h=>V(h)&&Ce(h)!=="body"),s=null;const a=Y(r).position==="fixed";let n=a?ce(r):r;for(;V(n)&&!ze(n);){const h=Y(n),d=vt(n);!d&&h.position==="fixed"&&(s=null),(a?!d&&!s:!d&&h.position==="static"&&!!s&&Vi.has(s.position)||Ie(n)&&!d&&ir(r,n))?i=i.filter(b=>b!==n):s=h,n=ce(n)}return e.set(r,i),i}function Ji(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const n=[...t==="clippingAncestors"?ct(e)?[]:Qi(e,this._c):[].concat(t),i],h=n[0],d=n.reduce((u,b)=>{const f=rr(e,b,s);return u.top=me(f.top,u.top),u.right=tt(f.right,u.right),u.bottom=tt(f.bottom,u.bottom),u.left=me(f.left,u.left),u},rr(e,h,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Xi(r){const{width:e,height:t}=$t(r);return{width:e,height:t}}function $i(r,e,t){const i=ie(e),s=re(e),a=t==="fixed",n=be(r,!0,a,e);let h={scrollLeft:0,scrollTop:0};const d=te(0);function u(){d.x=At(s)}if(i||!i&&!a)if((Ce(e)!=="body"||Ie(s))&&(h=ht(e)),i){const m=be(e,!0,a,e);d.x=m.x+e.clientLeft,d.y=m.y+e.clientTop}else s&&u();a&&!i&&s&&u();const b=s&&!i&&!a?tr(s,h):te(0),f=n.left+h.scrollLeft-d.x-b.x,x=n.top+h.scrollTop-d.y-b.y;return{x:f,y:x,width:n.width,height:n.height}}function Lt(r){return Y(r).position==="static"}function or(r,e){if(!ie(r)||Y(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return re(r)===t&&(t=t.ownerDocument.body),t}function sr(r,e){const t=Z(r);if(ct(r))return t;if(!ie(r)){let s=ce(r);for(;s&&!ze(s);){if(V(s)&&!Lt(s))return s;s=ce(s)}return t}let i=or(r,e);for(;i&&Ui(i)&&Lt(i);)i=or(i,e);return i&&ze(i)&&Lt(i)&&!vt(i)?t:i||Fi(r)||t}const eo=async function(r){const e=this.getOffsetParent||sr,t=this.getDimensions,i=await t(r.floating);return{reference:$i(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function to(r){return Y(r).direction==="rtl"}const ro={convertOffsetParentRelativeRectToViewportRelativeRect:Zi,getDocumentElement:re,getClippingRect:Ji,getOffsetParent:sr,getElementRects:eo,getClientRects:qi,getDimensions:Xi,getScale:Me,isElement:V,isRTL:to};function nr(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function io(r,e){let t=null,i;const s=re(r);function a(){var h;clearTimeout(i),(h=t)==null||h.disconnect(),t=null}function n(h,d){h===void 0&&(h=!1),d===void 0&&(d=1),a();const u=r.getBoundingClientRect(),{left:b,top:f,width:x,height:m}=u;if(h||e(),!x||!m)return;const k=it(f),C=it(s.clientWidth-(b+x)),z=it(s.clientHeight-(f+m)),E=it(b),U={rootMargin:-k+"px "+-C+"px "+-z+"px "+-E+"px",threshold:me(0,tt(1,d))||1};let j=!0;function I(qe){const Oe=qe[0].intersectionRatio;if(Oe!==d){if(!j)return n();Oe?n(!1,Oe):i=setTimeout(()=>{n(!1,1e-7)},1e3)}Oe===1&&!nr(u,r.getBoundingClientRect())&&n(),j=!1}try{t=new IntersectionObserver(I,{...U,root:s.ownerDocument})}catch{t=new IntersectionObserver(I,U)}t.observe(r)}return n(!0),a}function oo(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,u=Et(r),b=s||a?[...u?Ne(u):[],...Ne(e)]:[];b.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),a&&E.addEventListener("resize",t)});const f=u&&h?io(u,t):null;let x=-1,m=null;n&&(m=new ResizeObserver(E=>{let[M]=E;M&&M.target===u&&m&&(m.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var U;(U=m)==null||U.observe(e)})),t()}),u&&!d&&m.observe(u),m.observe(e));let k,C=d?be(r):null;d&&z();function z(){const E=be(r);C&&!nr(C,E)&&t(),C=E,k=requestAnimationFrame(z)}return t(),()=>{var E;b.forEach(M=>{s&&M.removeEventListener("scroll",t),a&&M.removeEventListener("resize",t)}),f==null||f(),(E=m)==null||E.disconnect(),m=null,d&&cancelAnimationFrame(k)}}const so=Ti,no=Oi,ao=zi,lo=(r,e,t)=>{const i=new Map,s={platform:ro,...t},a={...s.platform,_c:i};return Ci(r,e,{...s,platform:a})};class co{constructor({apiKey:e,baseUrl:t}){y(this,ve);y(this,Se);y(this,We);y(this,Be,et.API_TIMEOUT);y(this,F);y(this,je,0);y(this,Ze,0);p(this,Se,e),p(this,We,t)}async fetchAddress(e){return l(this,ve,Dt).call(this,"GET","/addressing/v2/address",{params:{address_id:e}})}async geocode(e,t={},i={}){const s={q:e,...t};return l(this,ve,Dt).call(this,"GET","/addressing/v2/autocomplete",{params:s,...i})}cancel(){o(this,F)&&(o(this,F).abort(),p(this,F,null))}createAbortController(){p(this,F,new AbortController)}getAbortSignal(){return o(this,F)||this.createAbortController(),o(this,F).signal}}Se=new WeakMap,We=new WeakMap,Be=new WeakMap,F=new WeakMap,je=new WeakMap,Ze=new WeakMap,ve=new WeakSet,zr=function(e){var t;throw e.name==="AbortError"?(Ge(this,Ze)._++,new Error("Request cancelled")):(Ge(this,je)._++,e.response?e.response.status===401?new Error("Unauthorized"):new Error(((t=e.response.data)==null?void 0:t.message)||"Unknown error"):navigator.onLine?e:new Error("Network error: No internet connection"))},Dt=async function(e,t,i={}){if(!o(this,Se))throw new Error("API Key is required");try{o(this,F)&&o(this,F).abort(),p(this,F,new AbortController);const s=new URL(t,o(this,We));i.params&&Object.entries(i.params).forEach(([n,h])=>{h!=null&&s.searchParams.append(n,h)});const a=await fetch(s,{method:e,headers:{accept:"application/json","x-api-key":o(this,Se),...i.headers},signal:o(this,F).signal,...o(this,Be)&&{signal:AbortSignal.timeout?AbortSignal.timeout(o(this,Be)):o(this,F).signal}});if(!a.ok){const n=new Error(`HTTP ${a.status}`);throw n.response={status:a.status,data:await a.json().catch(()=>({}))},n}return p(this,je,0),p(this,Ze,0),{data:await a.json()}}catch(s){return l(this,ve,zr).call(this,s)}finally{p(this,F,null)}};const ye={MENU:"rs-search-menu",RESULTS:"rs-search-results",LOADING:"rs-search-loading",LOADING_SPINNER:"rs-search-loading__spinner",LOADING_TEXT:"rs-search-loading__text",POWERED_BY:"rs-search-powered-by",CONTAINER:"rs-search-container"},he={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter",ESCAPE:"Escape"};class Ct{constructor(e){y(this,c);T(this,"_api");y(this,J);T(this,"_input");T(this,"_events");T(this,"_dropdown");T(this,"_dropdownContainer");y(this,D);y(this,X);y(this,G);y(this,H,-1);T(this,"_dropdownCleanup",null);y(this,ue,null);y(this,$,null);y(this,_e,"");y(this,Te,!1);y(this,B,!1);T(this,"_boundToMap",!1);T(this,"_filters",{categories:"StreetAddress,Scheme"});y(this,W,[]);T(this,"_handleChange");T(this,"_boundHandleBlur");T(this,"_boundHandleFocus");T(this,"_boundHandleKeydown");T(this,"_boundHandlePaste");T(this,"_boundHandleItemClick");l(this,c,Mr).call(this,e),l(this,c,Sr).call(this,e),l(this,c,Tr).call(this,e.element),this._api=new co({apiKey:o(this,J).key,baseUrl:o(this,J).url}),this._events=fi(),l(this,c,Or).call(this),l(this,c,Rr).call(this),l(this,c,Dr).call(this)}on(e,t){return this._events.on(e,t),this}off(e,t){return this._events.off(e,t),this}setFilters(e){this._filters=e}reset(){this._input.value="",l(this,c,gt).call(this),l(this,c,ae).call(this)}bindToMap(){this.setFilters({}),this._boundToMap=!0}unbindFromMap(){this._boundToMap=!1}async getAddress(e){const{data:t}=await this._api.fetchAddress(e);return t.data}async fetchSelectedAddress(){var e,t,i;if(!o(this,$))return console.warn("No candidate selected"),null;if(!((t=(e=o(this,$))==null?void 0:e.attributes)!=null&&t.address_id))return console.warn("No address ID available for selected candidate"),null;try{const s=await this._api.fetchAddress(o(this,$).attributes.address_id);return(i=s==null?void 0:s.data)!=null&&i.data?s.data.data:(console.warn("Invalid response structure from fetchAddress"),null)}catch(s){return console.error("Error fetching selected address:",s),this._events.emit("error",new Error("Failed to fetch address details")),null}}destroy(){var e,t;this._events.all.clear(),this._input.removeEventListener("input",this._handleChange),this._dropdown&&(this._input.removeEventListener("blur",this._boundHandleBlur),this._input.removeEventListener("focus",this._boundHandleFocus),this._input.removeEventListener("keydown",this._boundHandleKeydown),this._input.removeEventListener("paste",this._boundHandlePaste),this._dropdown.removeEventListener("click",this._boundHandleItemClick),(e=this._dropdownContainer)==null||e.remove(),(t=this._dropdownCleanup)==null||t.call(this)),this._api=null,this._input=null,this._dropdown=null,this._dropdownContainer=null}}J=new WeakMap,D=new WeakMap,X=new WeakMap,G=new WeakMap,H=new WeakMap,ue=new WeakMap,$=new WeakMap,_e=new WeakMap,Te=new WeakMap,B=new WeakMap,W=new WeakMap,c=new WeakSet,Mr=function(e){if(!(e!=null&&e.element))throw new Error(Ht.MISSING_ELEMENT)},Sr=function(e){p(this,J,{url:"https://api.cloud.riskscape.pro",showCategory:!1,showPoweredBy:!0,maxResults:et.DEFAULT_MAX_RESULTS,...e}),o(this,J).minChars=et.DEFAULT_MIN_CHARS},Tr=function(e){if(typeof e=="string")e.startsWith("#")||e.startsWith(".")?this._input=document.querySelector(e):this._input=document.getElementById(e);else if(e instanceof HTMLElement)this._input=e;else throw new Error("Element must be a string selector, element ID, or HTMLElement");if(!this._input)throw new Error(Ht.ELEMENT_NOT_FOUND(e));Object.assign(this._input,{autocomplete:"off"}),this._input.setAttribute("role","combobox"),this._input.setAttribute("aria-autocomplete","list"),this._input.setAttribute("aria-expanded","false"),this._input.setAttribute("aria-haspopup","listbox")},Or=function(){this._handleChange=mi(l(this,c,Vr).bind(this),et.DEFAULT_DEBOUNCE_TIME),this._boundHandleBlur=l(this,c,Yr).bind(this),this._boundHandleFocus=l(this,c,Qr).bind(this),this._boundHandleKeydown=l(this,c,Xr).bind(this),this._boundHandlePaste=l(this,c,Jr).bind(this),this._boundHandleItemClick=l(this,c,ri).bind(this)},Rr=function(){l(this,c,Ur).call(this)},Dr=function(){this._input.addEventListener("input",this._handleChange),this._input.addEventListener("blur",this._boundHandleBlur),this._input.addEventListener("focus",this._boundHandleFocus),this._input.addEventListener("keydown",this._boundHandleKeydown),this._input.addEventListener("paste",this._boundHandlePaste)},Ur=function(){l(this,c,Pr).call(this),l(this,c,Ir).call(this),l(this,c,Nr).call(this),l(this,c,Hr).call(this),l(this,c,Fr).call(this),l(this,c,Wr).call(this),l(this,c,Br).call(this)},Pr=function(){this._dropdownContainer=l(this,c,fe).call(this,"div",ye.CONTAINER)},Ir=function(){this._dropdown=l(this,c,fe).call(this,"nav",ye.MENU,{role:"listbox"}),this._dropdown.addEventListener("click",this._boundHandleItemClick),this._dropdownContainer.appendChild(this._dropdown)},Nr=function(){p(this,D,l(this,c,fe).call(this,"ul",ye.RESULTS)),this._dropdown.appendChild(o(this,D))},Hr=function(){o(this,J).showPoweredBy&&(p(this,G,l(this,c,fe).call(this,"div",ye.POWERED_BY,{style:{display:"none"}})),o(this,G).innerHTML='powered by <a href="https://riskscape.pro/powered-by" target="_blank">Riskscape</a>',this._dropdownContainer.appendChild(o(this,G)))},Fr=function(){p(this,X,l(this,c,fe).call(this,"div",ye.LOADING,{"aria-label":"Loading search results",role:"status",style:{display:"none"}}));const e=l(this,c,fe).call(this,"div",ye.LOADING_SPINNER),t=l(this,c,fe).call(this,"div",ye.LOADING_TEXT);t.textContent="Searching...",o(this,X).appendChild(e),o(this,X).appendChild(t),this._dropdown.appendChild(o(this,X))},Wr=function(){document.body.appendChild(this._dropdownContainer)},Br=function(){this._dropdownCleanup=oo(this._input,this._dropdownContainer,()=>{lo(this._input,this._dropdownContainer,{placement:"bottom-start",middleware:[so(5),ao(),no()]}).then(({x:e,y:t})=>{Object.assign(this._dropdownContainer.style,{top:`${t}px`,left:`${e}px`})})})},fe=function(e,t,i={}){const s=document.createElement(e);return s.className=t,Object.entries(i).forEach(([a,n])=>{a==="style"&&typeof n=="object"?Object.assign(s.style,n):s.setAttribute(a,n)}),s},Ae=function(){this._dropdown&&(o(this,$)&&p(this,H,o(this,ue)),p(this,B,!0),this._dropdown.style.display="block",o(this,G)&&(o(this,G).style.display="block"),this._input&&this._input.setAttribute("aria-expanded","true"))},ae=function(){if(!this._dropdown){p(this,B,!1);return}setTimeout(()=>{p(this,H,-1),p(this,B,!1),this._dropdown&&(this._dropdown.style.display="none"),o(this,G)&&(o(this,G).style.display="none"),this._input&&this._input.setAttribute("aria-expanded","false")},200)},jr=function(){p(this,H,-1),l(this,c,Ut).call(this),l(this,c,Qe).call(this),o(this,D).innerHTML="",this._dropdown.setAttribute("aria-expanded","true"),this._input.setAttribute("aria-controls","rs-search-results-list"),o(this,D).id="rs-search-results-list";const e=document.createDocumentFragment();if(o(this,W).forEach((t,i)=>{const s=l(this,c,Zr).call(this,t,i);e.appendChild(s)}),!o(this,W).length){const t=document.createElement("li");t.classList.add("rs-search-results__message"),t.innerHTML="<div>Search returned no results.</div>",e.appendChild(t)}o(this,D).appendChild(e),l(this,c,Ae).call(this)},Zr=function(e,t){const i=document.createElement("li");i.dataset.index=t.toString(),i.classList.add("rs-search-results__item"),i.setAttribute("role","option"),i.setAttribute("aria-selected","false"),i.setAttribute("id",`rs-search-result-${t}`);const s=e.candidate.split(", "),a=`<span>${s.shift()}</span>, ${s.join(", ")}`;let n="";return o(this,J).showCategory&&(n+=l(this,c,qr).call(this,e)),n&&(n=`<div class="rs-search-results__meta">${n}</div>`),i.innerHTML=`
|
|
17
|
+
<div class="rs-search-results__content">
|
|
18
|
+
<div class="rs-search-results__candidate">${a}</div>
|
|
19
|
+
${n}
|
|
20
|
+
</div>
|
|
21
|
+
`,i},qr=function(e){const t=[Ft(e.category),Ft(e.subcategory)];t[1]==="Sub Place"&&(t[1]="SubPlace");let i=t[1];return Wt(t[1],"Street Number")?i="Street Number":Wt(t[1],"Stand Number")?i="Stand Number":["Residential","Commercial"].includes(t[1])?i=t[1]+" Scheme":t[1]==="Scheme Unit"&&(i="Sectional Scheme Unit"),`<div class="rs-search-results__category">${i}</div>`},gt=function(){p(this,W,[]),p(this,_e,""),p(this,H,-1),l(this,c,Ut).call(this)},Ut=function(){p(this,ue,null),p(this,$,null)},Qe=function(){o(this,D).querySelectorAll("li").forEach((e,t)=>{e.classList.toggle("rs-search-results__item--hover",t===o(this,H))})},Kr=function(e){o(this,D).querySelectorAll("li").forEach((t,i)=>{t.classList.toggle("rs-search-results__item--selected",i===e)})},Gr=function(e){return typeof e!="string"?"":e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/<[^>]*>/g,"").replace(/[^\w\s,.-]/g,"").trim().slice(0,100)},Vr=async function(e){const t=l(this,c,Gr).call(this,e.target.value);if(t.length<o(this,J).minChars){o(this,B)&&(l(this,c,gt).call(this),l(this,c,ae).call(this));return}if(t!==o(this,_e)){p(this,_e,t),this._api.cancel(),this._api.createAbortController(),l(this,c,Je).call(this,!0),!o(this,B)&&this._dropdown&&l(this,c,Ae).call(this),this._events.emit("geocode:before",{query:t});try{const{data:i}=await this._api.geocode(t,this._filters);p(this,W,i.data.slice(0,o(this,J).maxResults)),o(this,W).length===0?l(this,c,Xe).call(this,"No results found. Try a different search term."):l(this,c,jr).call(this),this._events.emit("geocode:after",o(this,W))}catch(i){this._events.emit("error",i),i.message==="Network error: No response received"?l(this,c,Xe).call(this,"Network error. Please check your connection and try again."):i.message==="Unauthorized"?l(this,c,Xe).call(this,"Authentication error. Please check your API key."):i.message==="Request cancelled"||(l(this,c,Xe).call(this,"An error occurred while searching. Please try again."),console.error("Error fetching geocode results:",i))}finally{l(this,c,Je).call(this,!1)}}},Yr=function(){o(this,B)&&l(this,c,ae).call(this)},Qr=function(){o(this,W).length&&(this._boundToMap&&(this._input.value=o(this,_e)),l(this,c,Ae).call(this))},Jr=function(e){if(this._boundToMap)return;const t=e.clipboardData.getData("text/plain");if(l(this,c,gt).call(this),pi(t)){e.preventDefault();const[i,s]=t.split(",").map(a=>parseFloat(a).toFixed(6));this._events.emit("paste",{type:"latlon",data:{lat:i,lon:s}}),this._input.value=`${i}, ${s}`,this._input.blur(),l(this,c,ae).call(this)}else ui(t)&&(e.preventDefault(),this._events.emit("paste",{type:"property_key",data:t}),this._input.value=t,this._input.blur(),l(this,c,ae).call(this))},Xr=function(e){var a;const{key:t}=e;if(![he.ARROW_UP,he.ARROW_DOWN,he.ENTER,he.ESCAPE].includes(t))return;e.preventDefault();const s={[he.ARROW_DOWN]:()=>l(this,c,$r).call(this),[he.ARROW_UP]:()=>l(this,c,ei).call(this),[he.ENTER]:()=>l(this,c,ti).call(this),[he.ESCAPE]:()=>l(this,c,ae).call(this)};(a=s[t])==null||a.call(s)},$r=function(){if(!o(this,B)&&o(this,W).length){l(this,c,Ae).call(this);return}o(this,H)<o(this,W).length-1&&(Ge(this,H)._++,l(this,c,Pt).call(this),l(this,c,Qe).call(this))},ei=function(){o(this,B)&&o(this,H)>0&&(Ge(this,H)._--,l(this,c,Pt).call(this),l(this,c,Qe).call(this))},ti=function(){if(!o(this,B)&&o(this,W).length){l(this,c,Ae).call(this);return}if(o(this,H)>=0){l(this,c,bt).call(this);const e=o(this,D).querySelector(`li[data-index="${o(this,H)}"]`);e==null||e.click()}},Pt=function(){const e=o(this,D).querySelector(`li[data-index="${o(this,H)}"]`);e==null||e.scrollIntoView({block:"nearest",behavior:"smooth"})},bt=function(){this._input&&(this._input.disabled=!0,this._input.setAttribute("aria-disabled","true"))},It=function(){this._input&&(this._input.disabled=!1,this._input.setAttribute("aria-disabled","false"))},ri=async function(e){if(o(this,Te))return;const t=e.target.closest("li");if(!t)return;p(this,H,-1),l(this,c,Qe).call(this),p(this,ue,parseInt(t.dataset.index)),l(this,c,Kr).call(this,o(this,ue)),l(this,c,ae).call(this);const i=o(this,W)[o(this,ue)];if(p(this,$,i),this._boundToMap){l(this,c,bt).call(this),this._events.emit("select",{candidate:i}),this._input.value=i.candidate,setTimeout(()=>{l(this,c,It).call(this)},300);return}l(this,c,bt).call(this);try{const s=await l(this,c,ii).call(this);this._events.emit("select",{candidate:i,address:s}),this._input.value=(s==null?void 0:s.full_address)||i.candidate}catch(s){console.error("Error in handleItemClick:",s),this._events.emit("error",new Error("Failed to process selection"))}finally{l(this,c,It).call(this),this._input.blur()}},Je=function(e){if(p(this,Te,e),!!o(this,X)){if(e){if(o(this,X).style.display="flex",!o(this,B)&&o(this,D)){if(o(this,D).innerHTML="",o(this,D)){const t=document.createElement("li");t.classList.add("rs-search-results__message"),t.classList.add("rs-search-results__loading-placeholder"),o(this,D).appendChild(t)}this._dropdown&&(this._dropdown.style.display="block",this._dropdown.style.overflowY="hidden"),o(this,G)&&(o(this,G).style.display="block"),p(this,B,!0),this._input.setAttribute("aria-expanded","true")}}else if(o(this,X)&&(o(this,X).style.display="none"),o(this,D)){const t=o(this,D).querySelector(".rs-search-results__loading-placeholder");t&&t.remove(),this._dropdown&&(this._dropdown.style.overflowY="auto"),o(this,W).length===0&&o(this,D).querySelector(".rs-search-results__error")===null&&l(this,c,ae).call(this)}this._events.emit("loading",o(this,Te))}},Xe=function(e){o(this,D).innerHTML="";const t=document.createElement("li");t.classList.add("rs-search-results__message","rs-search-results__error"),t.innerHTML=`<div>${e}</div>`,o(this,D).appendChild(t),l(this,c,Ae).call(this)},ii=async function(){var e,t,i;if(!((t=(e=o(this,$))==null?void 0:e.attributes)!=null&&t.address_id))return console.warn("No address ID available for selected candidate"),null;l(this,c,Je).call(this,!0);try{const s=await this._api.fetchAddress(o(this,$).attributes.address_id);return(i=s==null?void 0:s.data)!=null&&i.data?s.data.data:(console.warn("Invalid response structure from fetchAddress"),null)}catch(s){return console.error("Error fetching candidate address:",s),this._events.emit("error",new Error("Failed to fetch address details")),null}finally{l(this,c,Je).call(this,!1)}},typeof window<"u"&&(window.RiskscapePlugins={RiskscapeMap:wt,RiskscapeSearch:Ct},window.RiskscapeSearch=Ct,window.RiskscapeMap=wt),w.RiskscapeMap=wt,w.RiskscapeSearch=Ct,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for riskscape-search (search-only build)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare module 'riskscape-search' {
|
|
6
|
+
/**
|
|
7
|
+
* RiskscapeSearch Options interface
|
|
8
|
+
*/
|
|
9
|
+
export interface RiskscapeSearchOptions {
|
|
10
|
+
/**
|
|
11
|
+
* ID of the input element
|
|
12
|
+
*/
|
|
13
|
+
element: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* API key for Riskscape service
|
|
17
|
+
*/
|
|
18
|
+
key: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Base URL for the API
|
|
22
|
+
*/
|
|
23
|
+
url?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show categories
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
showCategory?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether to show "powered by" text
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
showPoweredBy?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether to automatically fetch full address details on selection
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
autoFetchAddress?: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Maximum results to display
|
|
45
|
+
* @default 10
|
|
46
|
+
*/
|
|
47
|
+
maxResults?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Candidate result interface
|
|
52
|
+
*/
|
|
53
|
+
export interface Candidate {
|
|
54
|
+
candidate: string;
|
|
55
|
+
category: string;
|
|
56
|
+
subcategory: string;
|
|
57
|
+
attributes?: {
|
|
58
|
+
address_id?: string;
|
|
59
|
+
property_description?: string;
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Address result interface
|
|
66
|
+
*/
|
|
67
|
+
export interface Address {
|
|
68
|
+
id: string;
|
|
69
|
+
formatted_address: string;
|
|
70
|
+
components: {
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
};
|
|
73
|
+
geometry: {
|
|
74
|
+
location: {
|
|
75
|
+
lat: number;
|
|
76
|
+
lng: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Event handlers
|
|
84
|
+
*/
|
|
85
|
+
export type EventHandlers = {
|
|
86
|
+
'select': (data: { candidate: Candidate, address?: Address }) => void;
|
|
87
|
+
'error': (error: Error) => void;
|
|
88
|
+
'geocode:before': (data: { query: string }) => void;
|
|
89
|
+
'geocode:after': (results: Candidate[]) => void;
|
|
90
|
+
'loading': (isLoading: boolean) => void;
|
|
91
|
+
'paste': (data: { type: string, data: any }) => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Theme configuration interface
|
|
96
|
+
*/
|
|
97
|
+
export interface ThemeOptions {
|
|
98
|
+
/**
|
|
99
|
+
* Primary color for highlights and accents
|
|
100
|
+
*/
|
|
101
|
+
primaryColor?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Main text color
|
|
105
|
+
*/
|
|
106
|
+
textColor?: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Background color of the dropdown
|
|
110
|
+
*/
|
|
111
|
+
backgroundColor?: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Border color
|
|
115
|
+
*/
|
|
116
|
+
borderColor?: string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Border radius (e.g., '8px')
|
|
120
|
+
*/
|
|
121
|
+
borderRadius?: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Font family to use
|
|
125
|
+
*/
|
|
126
|
+
fontFamily?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Color for secondary text elements
|
|
130
|
+
*/
|
|
131
|
+
mutedColor?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Custom CSS variables (will be prefixed with --rs-search-)
|
|
135
|
+
*/
|
|
136
|
+
custom?: {
|
|
137
|
+
[key: string]: string;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* RiskscapeSearch class
|
|
143
|
+
*/
|
|
144
|
+
export class RiskscapeSearch {
|
|
145
|
+
/**
|
|
146
|
+
* Create a new RiskscapeSearch instance
|
|
147
|
+
*/
|
|
148
|
+
constructor(options: RiskscapeSearchOptions);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Register an event handler
|
|
152
|
+
*/
|
|
153
|
+
on<K extends keyof EventHandlers>(event: K, callback: EventHandlers[K]): this;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Remove an event handler
|
|
157
|
+
*/
|
|
158
|
+
off<K extends keyof EventHandlers>(event: K, callback: EventHandlers[K]): this;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Set search filters
|
|
162
|
+
*/
|
|
163
|
+
setFilters(filters: object): void;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get address by ID
|
|
167
|
+
*/
|
|
168
|
+
getAddress(addressId: string): Promise<Address>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Fetch the full address details for the currently selected candidate
|
|
172
|
+
* This method can be used when autoFetchAddress is disabled
|
|
173
|
+
*/
|
|
174
|
+
fetchSelectedAddress(): Promise<Address | null>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Reset the search input and results
|
|
178
|
+
*/
|
|
179
|
+
reset(): void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Clean up event listeners and DOM elements
|
|
183
|
+
*/
|
|
184
|
+
destroy(): void;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Default export for UMD compatibility
|
|
188
|
+
export default RiskscapeSearch;
|
|
189
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--rs-search-primary-color: #2563eb;--rs-search-secondary-color: #f8fafc;--rs-search-text-color: #333333;--rs-search-muted-color: #6b7280;--rs-search-border-color: #e5e7eb;--rs-search-error-color: #dc2626;--rs-search-success-color: #16a34a;--rs-search-menu-bg: white;--rs-search-menu-color: var(--rs-search-text-color);--rs-search-menu-font-size: .95rem;--rs-search-menu-font-family: inherit;--rs-search-menu-border: 1px solid var(--rs-search-border-color);--rs-search-menu-border-radius: 8px;--rs-search-menu-shadow: 0 4px 10px rgba(0, 0, 0, .1);--rs-search-menu-z-index: 1000;--rs-search-menu-max-height: 400px;--rs-search-item-padding: 10px 16px;--rs-search-item-hover-bg: var(--rs-search-secondary-color);--rs-search-item-selected-bg: var(--rs-search-secondary-color);--rs-search-item-selected-border-left: 3px solid var(--rs-search-primary-color);--rs-search-candidate-font-weight: 500;--rs-search-meta-font-size: .85rem;--rs-search-category-color: var(--rs-search-muted-color);--rs-search-loading-spinner-color: rgba(0, 0, 0, .3);--rs-search-loading-bg: rgba(255, 255, 255, .6);--rs-search-powered-by-bg: #f1f2f3;--rs-search-powered-by-color: #b01d21}@keyframes rs-loading-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rs-loading-pulse{0%,to{opacity:.6}50%{opacity:1}}.rs-search-container{position:absolute;top:0;left:0;z-index:var(--rs-search-menu-z-index);width:max-content;min-width:400px;max-width:480px;display:flex;flex-direction:column;pointer-events:none;filter:drop-shadow(0 4px 10px rgba(0,0,0,.1))}.rs-search-menu{position:relative;display:none;width:100%;max-width:none;max-height:var(--rs-search-menu-max-height);overflow:hidden;overflow-y:auto;-webkit-user-select:none;user-select:none;pointer-events:auto;box-shadow:none;background:var(--rs-search-menu-bg);border:var(--rs-search-menu-border);border-radius:var(--rs-search-menu-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:none;color:var(--rs-search-menu-color);font-family:var(--rs-search-menu-font-family);font-size:var(--rs-search-menu-font-size);font-weight:400;transition:box-shadow .2s ease,opacity .15s ease}@media only screen and (max-width: 479px){.rs-search-container{width:100%;min-width:unset;max-width:100%}.rs-search-results__item{padding:12px}}.rs-search-powered-by{font-size:.75em;text-align:right;padding:8px 12px;background:var(--rs-search-powered-by-bg);border:var(--rs-search-menu-border);border-top:none;border-bottom-left-radius:var(--rs-search-menu-border-radius);border-bottom-right-radius:var(--rs-search-menu-border-radius);width:100%;pointer-events:auto;box-shadow:none;position:relative}.rs-search-powered-by a,.rs-search-powered-by span{color:var(--rs-search-powered-by-color);text-decoration:none;transition:opacity .2s ease}.rs-search-powered-by a:hover{opacity:.8}.rs-search-loading{top:0;left:0;width:100%;height:100%;position:absolute;display:none;flex-direction:row;align-items:center;justify-content:center;background:var(--rs-search-loading-bg, rgba(255, 255, 255, .7));z-index:100;border-radius:var(--rs-search-menu-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;pointer-events:all;gap:8px}.rs-search-loading__spinner{width:16px;height:16px;border:1.5px solid rgba(0,0,0,.08);border-top:1.5px solid var(--rs-search-primary-color, #2563eb);border-radius:50%;animation:rs-loading-spin .7s linear infinite;margin:0;box-shadow:none;flex-shrink:0}.rs-search-loading__text{font-size:13px;color:var(--rs-search-text-color);font-weight:400;opacity:.75;letter-spacing:.01em;margin:0}.rs-search-results{margin:0;padding:0;list-style:none}.rs-search-results__item{cursor:pointer;padding:var(--rs-search-item-padding);line-height:1.5;transition:background-color .15s ease,padding-left .15s ease;position:relative}.rs-search-results__message{padding:var(--rs-search-item-padding);line-height:1.5;text-align:center;color:var(--rs-search-muted-color);display:flex;align-items:center;justify-content:center}.rs-search-results__loading-placeholder{min-height:50px;background:transparent;margin:0;padding:0}.rs-search-results__item+.rs-search-results__item{border-top:var(--rs-search-menu-border)}.rs-search-results__icon{margin-right:10px}.rs-search-results__content{display:flex;flex-direction:column;gap:4px}.rs-search-results__candidate{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--rs-search-text-color);line-height:1.4}.rs-search-results__candidate span{font-weight:var(--rs-search-candidate-font-weight)}.rs-search-results__meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:var(--rs-search-meta-font-size)}.rs-search-results__category{font-weight:500;color:var(--rs-search-category-color);background-color:#0000000d;padding:2px 8px;border-radius:4px;font-size:.8em;display:inline-block}.rs-search-results__description{font-size:.9em;color:var(--rs-search-muted-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rs-search-results__item:hover,.rs-search-results__item--hover{background-color:var(--rs-search-item-hover-bg)}.rs-search-results__item--selected{background-color:var(--rs-search-item-selected-bg);padding-left:calc(var(--rs-search-item-padding-left, 16px) + 3px)}.rs-search-results__item--selected:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background-color:var(--rs-search-primary-color)}.rs-search-results__error{padding:16px;color:var(--rs-search-error-color);background-color:#dc262605;margin:8px;border-radius:6px;max-height:none}.rs-search-results__error-message{display:flex;align-items:center;gap:10px;font-size:.95em}.rs-search-results__error-icon{font-size:18px}
|