cortex-react-ui 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/styles/Camera/index.css +4 -0
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import*as e from"react";import t,{useRef as r,useMemo as n,useState as o,useCall
|
|
|
15
15
|
/*!**************************************************************************************!*\
|
|
16
16
|
!*** external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} ***!
|
|
17
17
|
\**************************************************************************************/
|
|
18
|
-
/*! no static exports found */function(t,r){t.exports=e}}).default};var Ht=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}({exports:{}}.exports=Qt(t)),zt={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_t=t.createContext&&t.createContext(zt),Xt=["attr","size","title"];function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$t.apply(this,arguments)}function er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?er(Object(r),!0).forEach((function(t){rr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):er(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rr(e,t,r){var n;return(t="symbol"==typeof(n=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nr(e){return e&&e.map(((e,r)=>t.createElement(e.tag,tr({key:r},e.attr),nr(e.child))))}function or(e){return r=>t.createElement(ir,$t({attr:tr({},e.attr)},r),nr(e.child))}function ir(e){var r=r=>{var n,{attr:o,size:i,title:a}=e,s=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Xt),c=i||r.size||"1em";return r.className&&(n=r.className),e.className&&(n=(n?n+" ":"")+e.className),t.createElement("svg",$t({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,s,{className:n,style:tr(tr({color:e.color||r.color},r.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),a&&t.createElement("title",null,a),e.children)};return void 0!==_t?t.createElement(_t.Consumer,null,(e=>r(e))):r(zt)}function ar(e){return or({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z"},child:[]}]})(e)}function sr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"},child:[]}]})(e)}function cr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"},child:[]}]})(e)}function lr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function ur(e){return or({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"},child:[]},{tag:"path",attr:{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51zM10.95 21.96c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48v2.95z"},child:[]}]})(e)}function dr(e){return or({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10"},child:[]}]})(e)}var fr,pr=function(){function e(){this.dbName="cortex-react-media",this.storeName="capturedFiles",this.db=null}return e.prototype.openDatabase=function(){return D(this,void 0,void 0,(function(){var e=this;return F(this,(function(t){return[2,new Promise((function(t,r){var n=indexedDB.open(e.dbName,1);n.onupgradeneeded=function(t){n.result.createObjectStore(e.storeName,{keyPath:"id",autoIncrement:!0})},n.onsuccess=function(){e.db=n.result,t(e.db)},n.onerror=function(){return r(n.error)}}))]}))}))},e.prototype.storeFile=function(e){return D(this,void 0,void 0,(function(){var t=this;return F(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:[4,this.openDatabase()];case 1:r.sent(),r.label=2;case 2:return[2,new Promise((function(r,n){var o=t.db.transaction(t.storeName,"readwrite").objectStore(t.storeName).add({file:e,timestamp:Date.now(),name:e.name});o.onsuccess=function(){return r(o.result)},o.onerror=function(){return n(o.error)}}))]}}))}))},e.prototype.retrieveFile=function(e){return D(this,void 0,void 0,(function(){var t=this;return F(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:[4,this.openDatabase()];case 1:r.sent(),r.label=2;case 2:return[2,new Promise((function(r,n){var o=t.db.transaction([t.storeName],"readonly").objectStore(t.storeName).get(e);o.onsuccess=function(){var e=o.result;r(e?e.file:null)},o.onerror=function(){return n(o.error)}}))]}}))}))},e}(),hr=function(e){var t=e.onCapture,s=e.isOffline,c=void 0!==s&&s,l=e.mode,u=void 0===l?"photo":l,d=e.validateText,f=void 0===d?"Valider":d,p=e.resetText,h=void 0===p?"Annuler":p,g=e.isShowOffline,m=void 0!==g&&g;e.isShowVideoButton;var v=M(e,["onCapture","isOffline","mode","validateText","resetText","isShowOffline","isShowVideoButton"]),w=r(null),y=r(null),A=r(new pr),C=o(u),E=C[0],b=C[1],x=o(!1),B=x[0],I=x[1],q=o(!1),R=q[0],N=q[1],j=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||navigator.maxTouchPoints>0||"ontouchstart"in document.documentElement,G=function(){var e=r(null),t=o(0),a=t[0],s=t[1],c=function(e){var t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),o=e%60;return"".concat(t>0?t.toString().padStart(2,"0").concat(":"):"").concat(r>0?r.toString().padStart(2,"0").concat(":"):"").concat(n.toString().padStart(2,"0"),":").concat(o.toString().padStart(2,"0"))},l=n((function(){return c(a)}),[a]),u=i((function(){s(0),e.current=setInterval((function(){s((function(e){return e+1}))}),1e3)}),[]),d=i((function(){e.current&&(clearInterval(e.current),e.current=null)}),[]);return{formatTime:c,startTimer:u,stopTimer:d,formatedTime:l}}(),S=G.formatedTime,V=G.startTimer,Y=G.stopTimer,O=o({imageUrl:null,videoUrl:null,isRecording:!1,storedFileId:null,file:null}),P=O[0],L=O[1],Q=o({facingMode:{exact:"environment"},width:{min:200},height:{min:300}}),U=Q[0],W=Q[1];a((function(){return W({facingMode:j?"environment":"user",width:{min:200},height:{min:300}}),function(){Z(),Y(),H()}}),[]),a((function(){"video"===E&&I(!1)}),[P]);var K=i((function(){return D(void 0,void 0,void 0,(function(){var e,t,r,n,o,i,a,s,c,l;return F(this,(function(u){if(e=null===(l=w.current)||void 0===l?void 0:l.getScreenshot()){for(t=atob(e.split(",")[1]),r=new Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);o=new Uint8Array(r),i=new Blob([o],{type:"image/jpeg"}),a="captured_image_".concat(Date.now().toString().slice(-7),".jpg"),s=new File([i],a,{type:"image/jpeg"}),c=URL.createObjectURL(s),L((function(e){return T(T({},e),{imageUrl:c,file:s})}))}return[2]}))}))}),[w,c,t]),J=i((function(){if(w.current&&w.current.stream){var e="webm",t="video/".concat(e);MediaRecorder.isTypeSupported("video/mp4")&&(e="mp4",t="video/mp4");var r=new MediaRecorder(w.current.stream,{mimeType:t}),n=[];r.ondataavailable=function(e){e.data.size>0&&n.push(e.data)},r.onstop=function(){return D(void 0,void 0,void 0,(function(){var r,o,i,a;return F(this,(function(s){return r=new Blob(n,{type:t}),o="captured_video_".concat(Date.now(),".").concat(e),i=new File([r],o,{type:t}),a=URL.createObjectURL(i),L((function(e){return T(T({},e),{videoUrl:a,isRecording:!1,file:i})})),Y(),[2]}))}))},r.start(),y.current=r,V(),L((function(e){return T(T({},e),{isRecording:!0})}))}}),[w,c,V,Y,t]),Z=function(){L({imageUrl:null,videoUrl:null,isRecording:!1,storedFileId:null,file:null})};return k.exports.jsx("div",T({className:"camera-container"},{children:P.imageUrl||P.videoUrl?k.exports.jsxs("div",T({className:"camera-preview camera-screen-animation"},{children:[P.imageUrl&&k.exports.jsx("img",{src:P.imageUrl,alt:"Capturé",style:{height:"90%",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center"}}),P.videoUrl&&k.exports.jsxs("video",T({width:"100%",height:"90%",id:"video",style:{height:"90%",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center"},onEnded:function(){return I(!1)}},{children:[k.exports.jsx("source",{src:P.videoUrl,type:"video/mp4"}),k.exports.jsx("source",{src:P.videoUrl,type:"video/webm"}),k.exports.jsx("track",{kind:"captions",src:"",lang:"en",label:"English",default:!0}),"Your browser does not support the video."]})),P.videoUrl&&k.exports.jsx(le,T({variant:"contained",className:"video-play-btn",onClick:function(){var e=document.getElementById("video");try{e.paused?e.play():e.pause(),I(!B)}catch(e){}}},{children:B?k.exports.jsx(sr,{}):k.exports.jsx(cr,{})})),k.exports.jsxs("div",T({className:"camera-controls"},{children:[k.exports.jsx(le,T({variant:"contained",onClick:function(){return D(void 0,void 0,void 0,(function(){var e;return F(this,(function(r){switch(r.label){case 0:return c?[4,A.current.storeFile(P.file)]:[3,2];case 1:e=r.sent(),t({fileRowId:e,fileStoreName:"capturedFiles"}),r.label=2;case 2:return c||"photo"!==E||t({file:P.file,imageSrc:P.imageUrl}),c||"video"!==E||t({file:P.file,videoSrc:P.videoUrl}),Z(),[2]}}))}))},className:"camera-button camera-button--download"},{children:f})),k.exports.jsx(le,T({variant:"outlined",onClick:Z,className:"camera-button camera-button--reset"},{children:h}))]}))]})):k.exports.jsxs("div",T({className:"camera-preview"},{children:[P.isRecording&&k.exports.jsxs("div",T({className:"camera-recording-timer",style:{display:"video"===E?"flex":"none"}},{children:[k.exports.jsx("span",{className:"camera-recording-dot"}),k.exports.jsx("span",{children:S})]})),!P.isRecording&&k.exports.jsx("button",T({type:"button",onClick:function(){return b("photo"===E?"video":"photo"),void Z()},className:"camera-button camera-mode"},{children:k.exports.jsx("span",{children:"photo"===E?"Video":"Photo"})})),j&&!P.isRecording&&k.exports.jsx("button",T({type:"button",onClick:function(){N(!R),W({facingMode:R?"environment":"user",width:{min:200},height:{min:300}})},className:"camera-button camera-switch"},{children:k.exports.jsx(ur,{size:18})})),c&&m&&k.exports.jsx("div",T({className:"camera-offline-mode"},{children:"Offline mode"})),k.exports.jsx(Ht,T({ref:w,videoConstraints:U},v,{style:{height:"90% !important",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center"},screenshotFormat:"image/jpeg",allowFullScreen:!0})),k.exports.jsxs("div",T({className:"camera-controls"},{children:["photo"===E&&k.exports.jsx(le,T({variant:"contained",className:"camera-button camera-button--capture",onClick:K},{children:k.exports.jsx(ar,{size:28})})),"video"===E&&!P.isRecording&&k.exports.jsx(le,T({variant:"contained",onClick:J,className:"camera-button camera-button--record"},{children:k.exports.jsx(dr,{size:30})})),"video"===E&&P.isRecording&&k.exports.jsx(le,T({variant:"contained",onClick:H,className:"camera-button camera-button--record"},{children:k.exports.jsx(lr,{size:28})}))]}))]}))}));function H(){y.current&&y.current.stop()}},gr=function(e){var r=e.selected,n=e.value,o=e.size,i=e.children,a=e.className,s=e.onChange,c=t.useCallback((function(){s&&s(n)}),[s,n]);return k.exports.jsx("button",T({type:"button",className:U("ui-toggleBtn",void 0!==o?"ui-toggleBtn-size-".concat(o):"ui-toggleBtn-size-md",!0===r?"ui-toggleBtn-selected":null,a),onClick:c},{children:i}))};!function(e){e[e.Enter=0]="Enter",e[e.Entering=1]="Entering",e[e.Entered=2]="Entered",e[e.Exit=3]="Exit",e[e.Exiting=4]="Exiting",e[e.Exited=5]="Exited"}(fr||(fr={}));var mr=t.forwardRef((function(e,r){var n=e.trigger,o=e.mode,i=void 0===o?"appear":o,a=e.children,s=e.enterTimeout,c=e.exitTimeout,l=e.className,u=e.onEnter,d=e.onEntering,f=e.onEntered,p=e.onExit,h=e.onExiting,g=e.onExited,m=t.useRef(null),v=t.useRef(),w=t.useState((function(){return"appear"===i?fr.Exited:fr.Entered}));w[0],w[1],t.useEffect((function(){return function(){v.current&&window.clearTimeout(v.current)}}),[v]),t.useEffect((function(){n?(v.current&&window.clearTimeout(v.current),m.current.classList.remove("".concat(l,"-exit")),m.current.classList.remove("".concat(l,"-exiting")),m.current.classList.remove("".concat(l,"-exited")),u&&u(),m.current.classList.add("".concat(l,"-enter")),v.current=window.setTimeout((function(){d&&d(),m.current&&m.current.classList.add("".concat(l,"-entering")),v.current=window.setTimeout((function(){f&&f(),m.current&&m.current.classList.add("".concat(l,"-entered"))}),s||1e3)}),10)):(v.current&&window.clearTimeout(v.current),m.current.classList.remove("".concat(l,"-enter")),m.current.classList.remove("".concat(l,"-entering")),m.current.classList.remove("".concat(l,"-entered")),p&&p(),m.current.classList.add("".concat(l,"-exit")),v.current=window.setTimeout((function(){h&&h(),m.current&&m.current.classList.add("".concat(l,"-exiting")),v.current=window.setTimeout((function(){g&&g(),m.current&&m.current.classList.add("".concat(l,"-exited"))}),c||1e3)})))}),[n]);var y=t.useMemo((function(){if(a){var e=T(T({},a.props),{className:U(l,a.props.className),ref:m});return t.cloneElement(a,e)}}),[a,m]);return k.exports.jsx(k.exports.Fragment,{children:y})}));mr.propTypes={},mr.defaultProps={};var vr=t.forwardRef((function(e,t){var r=e.trigger,n=e.children,o=e.onEnter,i=e.onEntering,a=e.onEntered,s=e.onExit,c=e.onExiting,l=e.onExited;return k.exports.jsx(mr,T({ref:t,trigger:r,mode:"appear",className:"ui-fade",enterTimeout:160,exitTimeout:160,onEnter:o,onExit:s,onEntering:i,onEntered:a,onExiting:c,onExited:l},{children:n}))}));vr.propTypes={},vr.defaultProps={};var wr=function(e){var r=e.children,n=e.title;e.anchorEl;var o=e.enterDelay,i=void 0===o?0:o,a=e.leaveDelay,s=void 0===a?0:a,c=e.className,l=e.disabled,u=t.useState(void 0),d=u[0],f=u[1],p=t.useState(!1),h=p[0],g=p[1],m=t.useState(!0),v=m[0],w=m[1],y=t.useState(!1),A=y[0],C=y[1],E=t.useRef(),b=t.useRef();t.useEffect((function(){!0===l&&g(!1)}),[l]);var x,B=function(){g(!0)},M=function(){g(!1)},D=function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),b.current=setTimeout((function(){M()}),s))},F=function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),i)))},I=function(e){C(!0),clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),2e3))},q=function(e){clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),b.current=setTimeout((function(){M()}),3e3)};if(r){var R=T(T({},r.props),{onFocus:function(e){d||f(e.currentTarget),E.current=setTimeout((function(){B()}),i)},onMouseEnter:function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),i)))},onMouseLeave:D,onMouseOver:F,onTouchStart:I,onTouchEnd:q});x=t.cloneElement(r,R)}var N=h||!v;return k.exports.jsxs(k.exports.Fragment,{children:[x,k.exports.jsx(ie,T({role:"tooltip",anchorEl:d,open:N,className:U("ui-tooltip",c),onMouseOver:A?void 0:F,onMouseLeave:A?void 0:D,onTouchStart:I,onTouchEnd:q},{children:k.exports.jsx(vr,T({trigger:h,onEnter:function(){w(!1)},onExited:function(){w(!0)}},{children:k.exports.jsx("div",T({className:"ui-tooltip-content"},{children:n}))}))}))]})};function yr(t,r){var n=e.useCallback((function(e){var n=e.target,o=r.reduce((function(e,t){if(!t)return e;var r=function(e){var t;if(!e)return document.body;if("[object String]"===Object.prototype.toString.call(e)){var r=document.getElementById(e);return null!=r?r:document.body}var n=e;return n&&void 0!==n.current?null!==(t=n.current)&&void 0!==t?t:void 0:e}(t);return!1!==e&&r&&null!==r?!r.contains(n):e}),!0);t&&o&&t()}),[t]);e.useEffect((function(){return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}),[r,n])}var Ar=function(e){var t=e.tag;e.className;var r=e.onDelete;return k.exports.jsxs("span",T({className:"ui-taginputItem"},{children:[k.exports.jsx("span",T({className:"ui-taginputItemLabel"},{children:t.label})),k.exports.jsx("button",T({type:"button",className:"ui-taginputItemRemove",onClick:r},{children:"x"}))]}))},Cr=t.forwardRef((function(e,r){var n=e.className,o=e.value,i=e.onClick,a=e.onChange,s=t.useRef(null),c=t.useCallback((function(e){a&&a(e.target.value)}),[a]);return t.useEffect((function(){if(r&&s)return Q(r,s.current),function(){Q(r,null)}}),[r,s]),k.exports.jsx(k.exports.Fragment,{children:k.exports.jsx("input",{ref:s,value:o,className:U("ui-taginputFilter",n),autoComplete:"off",spellCheck:"false","data-form-type":"other",onChange:c,onClick:i})})})),Er=function(e){var r=e.suggestion,n=e.onClick,o=t.useCallback((function(e){n&&n(r,e)}),[n]);return k.exports.jsx("div",T({role:"button",className:"ui-taginputSelectItem",tabIndex:0,onClick:o},{children:r.label}))},br=function(e){var t=e.group,r=e.onClick,n=Array.isArray(t.suggestions)?t.suggestions.map((function(e,t){return!0===e.group?k.exports.jsx(br,{group:e,onClick:r},t):k.exports.jsx(Er,{suggestion:e,onClick:r},t)})):null;return k.exports.jsxs("div",T({className:"ui-taginputSelectGroup"},{children:[k.exports.jsx("span",T({className:"ui-taginputSelectGroupLabel"},{children:t.label})),k.exports.jsx("div",T({className:"ui-taginputSelectGroupItems"},{children:n}))]}))},xr=t.forwardRef((function(e,r){var n=e.open,o=e.tags,i=e.disableFilter,a=e.suggestions,s=e.anchorEl,c=e.filter,l=e.onSuggestionClick,u=t.useMemo((function(){if(!Array.isArray(a))return[];if(i)return a;var e=Array.isArray(o)&&o.length>0,t=c&&c.length>0,r=[];return a.forEach((function(n){if(!0!==n.group)e&&o.some((function(e){return e.id===n.id}))||t&&n.label.toUpperCase().indexOf(c.toUpperCase())<0||r.push(T({},n));else if(Array.isArray(n.suggestions)){var i=T(T({},n),{suggestions:[]});n.suggestions.forEach((function(r){e&&o.some((function(e){return e.id===r.id}))||t&&r.label.toUpperCase().indexOf(c.toUpperCase())<0||i.suggestions.push(T({},r))})),i.suggestions.length>0&&r.push(i)}})),r}),[a,c,o]),d=t.useCallback((function(e){l&&l(e)}),[l]),f=n&&u.length>0,p=u.map((function(e,t){return!0===e.group?k.exports.jsx(br,{group:e,onClick:d},t):k.exports.jsx(Er,{suggestion:e,onClick:d},t)}));return k.exports.jsx(ie,T({ref:r,open:f,anchorEl:s,placement:H},{children:k.exports.jsx("div",T({className:"ui-taginputSelect"},{children:p}))}))})),Br=function(e){var r=e.tags;e.className;var n=e.suggestions,o=e.disableFilter,i=e.onTextChange,a=e.onChange,s=t.useRef(null),c=t.useRef(null),l=t.useRef(null),u=t.useState(""),d=u[0],f=u[1],p=t.useState(!1),h=p[0],g=p[1];yr((function(){g(!1)}),[s,c]);var m=t.useCallback((function(e){if(a&&Array.isArray(r)){var t=r.findIndex((function(t){return t.id===e.id}));if(!(t<0)){var n=I([],r,!0);n.splice(t,1),a(n)}}}),[r,a]),v=t.useCallback((function(e){if(e){var t={id:e.id,label:e.label,value:e.value},n=Array.isArray(r)?I(I([],r,!0),[t],!1):[t];g(!1),a&&a(n),f(""),i&&i("")}}),[r,a,i]),w=t.useCallback((function(e){f(e),i&&i(e)}),[i]),y=Array.isArray(r)?r.map((function(e,t){return k.exports.jsx(Ar,{tag:e,onDelete:function(){return m(e)}},t)})):[];return k.exports.jsxs("div",T({ref:l,className:"ui-taginput"},{children:[y,k.exports.jsx(Cr,{ref:s,value:d,onChange:w,onClick:function(){g(!0)}}),k.exports.jsx(xr,{ref:c,open:h,anchorEl:s,filter:d,tags:r,suggestions:n,disableFilter:o,onSuggestionClick:v})]}))};function Tr(e,t){return Object.freeze({...e,...t})}const Mr=c(null),Dr=Mr.Provider;function Fr(){const e=l(Mr);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function Ir(e){return u((function(r,n){const{instance:o,context:i}=e(r).current;return d(n,(()=>o)),null==r.children?null:t.createElement(Dr,{value:i},r.children)}))}function kr(e,t){const n=r();a((function(){return null!=t&&e.instance.on(t),n.current=t,function(){null!=n.current&&e.instance.off(n.current),n.current=null}}),[e,t])}function qr(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function Rr(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function Nr(e,t){return null==t?function(t,n){const o=r();return o.current||(o.current=e(t,n)),o}:function(n,o){const i=r();i.current||(i.current=e(n,o));const s=r(n),{instance:c}=i.current;return a((function(){s.current!==n&&(t(c,n,s.current),s.current=n)}),[c,n,o]),i}}function jr(e,t){a((function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){t.layerContainer?.removeLayer(e.instance),t.map.removeLayer(e.instance)}}),[t,e])}function Gr(e){return function(t){const n=Fr(),o=e(qr(t,n),n);return function(e,t){const n=r(t);a((function(){t!==n.current&&null!=e.attributionControl&&(null!=n.current&&e.attributionControl.removeAttribution(n.current),null!=t&&e.attributionControl.addAttribution(t)),n.current=t}),[e,t])}(n.map,t.attribution),kr(o.current,t.eventHandlers),jr(o.current,n),o}}function Sr(e,t){return Ir(function(e){return function(t){const n=Fr(),o=e(qr(t,n),n);return kr(o.current,t.eventHandlers),jr(o.current,n),function(e,t){const n=r();a((function(){if(t.pathOptions!==n.current){const r=t.pathOptions??{};e.instance.setStyle(r),n.current=r}}),[e,t])}(o.current,t),o}}(Nr(e,t)))}function Vr(){return Fr().map}const Yr=Sr((function({children:e,...t},r){const n=new m([],t);return Rr(n,Tr(r,{layerContainer:n,overlayContainer:n}))}));function Or(){return Or=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Or.apply(this,arguments)}const Pr=u((function({bounds:e,boundsOptions:r,center:n,children:s,className:c,id:l,placeholder:u,style:f,whenReady:p,zoom:h,...g},m){const[w]=o({className:c,id:l,style:f}),[y,A]=o(null);d(m,(()=>y?.map??null),[y]);const C=i((t=>{if(null!==t&&null===y){const o=new v(t,g);null!=n&&null!=h?o.setView(n,h):null!=e&&o.fitBounds(e,r),null!=p&&o.whenReady(p),A(function(e){return Object.freeze({__version:1,map:e})}(o))}}),[]);a((()=>()=>{y?.map.remove()}),[y]);const E=y?t.createElement(Dr,{value:y},s):u??null;return t.createElement("div",Or({},w,{ref:C}),E)})),Lr=Ir(Gr(Nr((function({position:e,...t},r){const n=new w(e,t);return Rr(n,Tr(r,{overlayContainer:n}))}),(function(e,t,r){t.position!==r.position&&e.setLatLng(t.position),null!=t.icon&&t.icon!==r.icon&&e.setIcon(t.icon),null!=t.zIndexOffset&&t.zIndexOffset!==r.zIndexOffset&&e.setZIndexOffset(t.zIndexOffset),null!=t.opacity&&t.opacity!==r.opacity&&e.setOpacity(t.opacity),null!=e.dragging&&t.draggable!==r.draggable&&(!0===t.draggable?e.dragging.enable():e.dragging.disable())})))),Qr=Sr((function({positions:e,...t},r){const n=new y(e,t);return Rr(n,Tr(r,{overlayContainer:n}))}),(function(e,t,r){t.positions!==r.positions&&e.setLatLngs(t.positions)})),Ur=function(e){return u((function(t,r){const{instance:n}=e(t).current;return d(r,(()=>n)),null}))}(Gr(Nr((function({url:e,...t},r){return Rr(new A(e,qr(t,r)),r)}),(function(e,t,r){!function(e,t,r){const{opacity:n,zIndex:o}=t;null!=n&&n!==r.opacity&&e.setOpacity(n),null!=o&&o!==r.zIndex&&e.setZIndex(o)}(e,t,r);const{url:n}=t;null!=n&&n!==r.url&&e.setUrl(n)}))));var Wr,Kr=c({locations:[],setLocations:function(){}});void 0===(Wr=window.leafletActiveAreaPreviousMethods)&&(Wr={getCenter:L.Map.prototype.getCenter,setView:L.Map.prototype.setView,flyTo:L.Map.prototype.flyTo,setZoomAround:L.Map.prototype.setZoomAround,getBoundsZoom:L.Map.prototype.getBoundsZoom,PopupAdjustPan:L.Popup.prototype._adjustPan,RendererUpdate:L.Renderer.prototype._update}),L.Map.include({getBounds:function(){if(this._viewport)return this.getViewportLatLngBounds();var e=this.getPixelBounds(),t=this.unproject(e.getBottomLeft()),r=this.unproject(e.getTopRight());return new L.LatLngBounds(t,r)},getViewport:function(){return this._viewport},getViewportBounds:function(){var e=this._viewport,t=L.point(e.offsetLeft,e.offsetTop),r=L.point(e.clientWidth,e.clientHeight);return 0!==r.x&&0!==r.y||(e=this.getContainer())&&(t=L.point(0,0),r=L.point(e.clientWidth,e.clientHeight)),L.bounds(t,t.add(r))},getViewportLatLngBounds:function(){var e=this.getViewportBounds();return L.latLngBounds(this.containerPointToLatLng(e.min),this.containerPointToLatLng(e.max))},getOffset:function(){var e=this.getSize().divideBy(2),t=this.getViewportBounds().getCenter();return e.subtract(t)},getCenter:function(e){var t=Wr.getCenter.call(this);if(this.getViewport()&&!e){var r=this.getZoom(),n=this.project(t,r);n=n.subtract(this.getOffset()),t=this.unproject(n,r)}return t},setView:function(e,t,r){if(e=L.latLng(e),t=void 0===t?this._zoom:this._limitZoom(t),this.getViewport()){var n=this.project(e,this._limitZoom(t));n=n.add(this.getOffset()),e=this.unproject(n,this._limitZoom(t))}return Wr.setView.call(this,e,t,r)},flyTo:function(e,t,r){if(e=L.latLng(e),t=void 0===t?s:t,this.getViewport()){var n=this.project(e,this._limitZoom(t));n=n.add(this.getOffset()),e=this.unproject(n,this._limitZoom(t))}if(!1===(r=r||{}).animate||!L.Browser.any3d)return this.setView(e,t,r);this._stop();var o=this.project(Wr.getCenter.call(this)),i=this.project(e),a=this.getSize(),s=this._zoom,c=Math.max(a.x,a.y),l=c*this.getZoomScale(s,t),u=i.distanceTo(o)||1,d=1.42,f=2.0164;function p(e){var t=(l*l-c*c+(e?-1:1)*f*f*u*u)/(2*(e?l:c)*f*u),r=Math.sqrt(t*t+1)-t;return r<1e-9?-18:Math.log(r)}function h(e){return(Math.exp(e)-Math.exp(-e))/2}function g(e){return(Math.exp(e)+Math.exp(-e))/2}var m=p(0);var v=Date.now(),w=(p(1)-m)/d,y=r.duration?1e3*r.duration:1e3*w*.8;return this._moveStart(!0,r.noMoveStart),function r(){var n=(Date.now()-v)/y,a=function(e){return 1-Math.pow(1-e,1.5)}(n)*w;n<=1?(this._flyToFrame=L.Util.requestAnimFrame(r,this),this._move(this.unproject(o.add(i.subtract(o).multiplyBy(function(e){return c*(g(m)*function(e){return h(e)/g(e)}(m+d*e)-h(m))/f}(a)/u)),s),this.getScaleZoom(c/function(e){return c*(g(m)/g(m+d*e))}(a),s),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}.call(this),this},setZoomAround:function(e,t,r){if(this.getViewport()){var n=this.getZoomScale(t),o=this.getViewportBounds().getCenter(),i=(e instanceof L.Point?e:this.latLngToContainerPoint(e)).subtract(o).multiplyBy(1-1/n),a=this.containerPointToLatLng(o.add(i));return this.setView(a,t,{zoom:r})}return Wr.setZoomAround.call(this,e,t,r)},getBoundsZoom:function(e,t,r){e=L.latLngBounds(e),r=L.point(r||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),i=this.getMaxZoom(),a=e.getNorthWest(),s=e.getSouthEast(),c=this.getViewport(),l=(c?L.point(c.clientWidth,c.clientHeight):this.getSize()).subtract(r),u=this.project(s,n).subtract(this.project(a,n)),d=L.Browser.any3d?this.options.zoomSnap:1,f=l.x/u.x,p=l.y/u.y,h=t?Math.max(f,p):Math.min(f,p);return n=this.getScaleZoom(h,n),d&&(n=Math.round(n/(d/100))*(d/100),n=t?Math.ceil(n/d)*d:Math.floor(n/d)*d),Math.max(o,Math.min(i,n))},setActiveArea:function(e,t,r){var n;if(t&&this._zoom&&(n=this.getCenter()),!this._viewport){var o=this.getContainer();this._viewport=L.DomUtil.create("div",""),o.insertBefore(this._viewport,o.firstChild)}return"string"==typeof e?this._viewport.className=e:L.extend(this._viewport.style,e),n&&this.setView(n,this.getZoom(),{animate:!!r}),this}}),L.Renderer.include({_onZoom:function(){this._updateTransform(this._map.getCenter(!0),this._map.getZoom())},_update:function(){Wr.RendererUpdate.call(this),this._center=this._map.getCenter(!0)}}),L.GridLayer.include({_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(void 0!==e){for(var r in this._levels)r=Number(r),this._levels[r].el.children.length||r===e?(this._levels[r].el.style.zIndex=t-Math.abs(e-r),this._onUpdateLevel(r)):(L.DomUtil.remove(this._levels[r].el),this._removeTilesAtZoom(r),this._onRemoveLevel(r),delete this._levels[r]);var n=this._levels[e],o=this._map;return n||((n=this._levels[e]={}).el=L.DomUtil.create("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=t,n.origin=o.project(o.unproject(o.getPixelOrigin()),e).round(),n.zoom=e,this._setZoomTransform(n,o.getCenter(!0),o.getZoom()),L.Util.falseFn(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(!0),this._map.getZoom(),t,t)},_update:function(e){var t=this._map;if(t){var r=this._clampZoom(t.getZoom());if(void 0===e&&(e=t.getCenter(!0)),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(e),o=this._pxBoundsToTileRange(n),i=o.getCenter(),a=[],s=this.options.keepBuffer,c=new L.Bounds(o.getBottomLeft().subtract([s,-s]),o.getTopRight().add([s,-s]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var l in this._tiles){var u=this._tiles[l].coords;u.z===this._tileZoom&&c.contains(new L.Point(u.x,u.y))||(this._tiles[l].current=!1)}if(Math.abs(r-this._tileZoom)>1)this._setView(e,r);else{for(var d=o.min.y;d<=o.max.y;d++)for(var f=o.min.x;f<=o.max.x;f++){var p=new L.Point(f,d);if(p.z=this._tileZoom,this._isValidTile(p)){var h=this._tiles[this._tileCoordsToKey(p)];h?h.current=!0:a.push(p)}}if(a.sort((function(e,t){return e.distanceTo(i)-t.distanceTo(i)})),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(f=0;f<a.length;f++)this._addTile(a[f],g);this._level.el.appendChild(g)}}}}}}),L.Popup.include({_adjustPan:function(){if(this._map._viewport){if(!this.options.autoPan)return;this._map._panAnim&&this._map._panAnim.stop();var e=this._map,t=e._viewport,r=this._container.offsetHeight,n=this._containerWidth,o=L.point(t.offsetLeft,t.offsetTop),i=new L.Point(this._containerLeft-o.x,-r-this._containerBottom-o.y);i._add(L.DomUtil.getPosition(this._container));var a=e.layerPointToContainerPoint(i),s=L.point(this.options.autoPanPadding),c=L.point(this.options.autoPanPaddingTopLeft||s),l=L.point(this.options.autoPanPaddingBottomRight||s),u=L.point(t.clientWidth,t.clientHeight),d=0,f=0;a.x+n+l.x>u.x&&(d=a.x+n-u.x+l.x),a.x-d-c.x<0&&(d=a.x-c.x),a.y+r+l.y>u.y&&(f=a.y+r-u.y+l.y),a.y-f-c.y<0&&(f=a.y-c.y),(d||f)&&e.fire("autopanstart").panBy([d,f])}else Wr.PopupAdjustPan.call(this)}});var Jr=function(e){var t=Vr();a((function(){t.setActiveArea("cortex-widget-viewport",!0,!0),g.Control.CenterActiveArea=g.Control.extend({onAdd:function(){var e;e=t.zoomControl&&!this.options.forceSeparateButton?t.zoomControl._container:g.DomUtil.create("div","leaflet-bar"),g.DomEvent.disableClickPropagation(e);var r=g.DomUtil.create("a","",e);return r.href="#",r.title="Centrer",r.innerHTML='\n <img src="'.concat(Zr,'" width="15px" style="margin-top: 7px; filter: brightness(0%)" />\n '),r.setAttribute("role","button"),r.setAttribute("aria-label",r.title),g.DomEvent.on(r,"click",g.DomEvent.stop).on(r,"click",s),e}}),g.control.centerActiveArea=function(e){return new g.Control.CenterActiveArea(e)},g.control.centerActiveArea({position:"topleft"}).addTo(t),e.autoCenter&&o()}),[]),a((function(){console.log(e.autoCenter),e.autoCenter&&o()}),[e.autoCenter]);var r=i((function(){var e=g.featureGroup();return t.eachLayer((function(t){t instanceof g.Marker&&e.addLayer(t)})),e}),[t]),n=i((function(){var e=g.featureGroup();return t.eachLayer((function(t){t instanceof g.Polygon&&e.addLayer(t)})),e}),[t]),o=i((function(){var e=r().getBounds();n().eachLayer((function(t){e.extend(t.getBounds())})),e.isValid()&&t.fitBounds(e,{animate:!0})}),[]),s=i((function(){o()}),[t]);return k.exports.jsx(k.exports.Fragment,{})},Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAABcRAAAXEQHKJvM/AAAAB3RJTUUH4wMIFTgXULHJFAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAhUlEQVRo3u3asQ2AIBAF0MO4p42FI1nYOKlugAUnJvL+BLzwcxGw7Md5RUO2dSmRkNZ1TPGTgICADAIptbGXNVqzUluraoGADAKZv/rIy56UqvVFartVVEu1QEBAQEBAQEBAQEAaz+xuGlXrpWr1PlvbERAQEJCIhzfEnqPYLxwgICBjQW7ewSYPr/zk7gAAAABJRU5ErkJggg==",Hr={exports:{}};
|
|
18
|
+
/*! no static exports found */function(t,r){t.exports=e}}).default};var Ht=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}({exports:{}}.exports=Qt(t)),zt={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_t=t.createContext&&t.createContext(zt),Xt=["attr","size","title"];function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$t.apply(this,arguments)}function er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?er(Object(r),!0).forEach((function(t){rr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):er(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rr(e,t,r){var n;return(t="symbol"==typeof(n=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nr(e){return e&&e.map(((e,r)=>t.createElement(e.tag,tr({key:r},e.attr),nr(e.child))))}function or(e){return r=>t.createElement(ir,$t({attr:tr({},e.attr)},r),nr(e.child))}function ir(e){var r=r=>{var n,{attr:o,size:i,title:a}=e,s=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Xt),c=i||r.size||"1em";return r.className&&(n=r.className),e.className&&(n=(n?n+" ":"")+e.className),t.createElement("svg",$t({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,s,{className:n,style:tr(tr({color:e.color||r.color},r.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),a&&t.createElement("title",null,a),e.children)};return void 0!==_t?t.createElement(_t.Consumer,null,(e=>r(e))):r(zt)}function ar(e){return or({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z"},child:[]}]})(e)}function sr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"},child:[]}]})(e)}function cr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"},child:[]}]})(e)}function lr(e){return or({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function ur(e){return or({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"},child:[]},{tag:"path",attr:{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51zM10.95 21.96c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48v2.95z"},child:[]}]})(e)}function dr(e){return or({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10"},child:[]}]})(e)}var fr,pr=function(){function e(){this.dbName="cortex-react-media",this.storeName="capturedFiles",this.db=null}return e.prototype.openDatabase=function(){return D(this,void 0,void 0,(function(){var e=this;return F(this,(function(t){return[2,new Promise((function(t,r){var n=indexedDB.open(e.dbName,1);n.onupgradeneeded=function(t){n.result.createObjectStore(e.storeName,{keyPath:"id",autoIncrement:!0})},n.onsuccess=function(){e.db=n.result,t(e.db)},n.onerror=function(){return r(n.error)}}))]}))}))},e.prototype.storeFile=function(e){return D(this,void 0,void 0,(function(){var t=this;return F(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:[4,this.openDatabase()];case 1:r.sent(),r.label=2;case 2:return[2,new Promise((function(r,n){var o=t.db.transaction(t.storeName,"readwrite").objectStore(t.storeName).add({file:e,timestamp:Date.now(),name:e.name});o.onsuccess=function(){return r(o.result)},o.onerror=function(){return n(o.error)}}))]}}))}))},e.prototype.retrieveFile=function(e){return D(this,void 0,void 0,(function(){var t=this;return F(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:[4,this.openDatabase()];case 1:r.sent(),r.label=2;case 2:return[2,new Promise((function(r,n){var o=t.db.transaction([t.storeName],"readonly").objectStore(t.storeName).get(e);o.onsuccess=function(){var e=o.result;r(e?e.file:null)},o.onerror=function(){return n(o.error)}}))]}}))}))},e}(),hr=function(e){var t=e.onCapture,s=e.isOffline,c=void 0!==s&&s,l=e.mode,u=void 0===l?"photo":l,d=e.validateText,f=void 0===d?"Valider":d,p=e.resetText,h=void 0===p?"Annuler":p,g=e.isShowOffline,m=void 0!==g&&g;e.isShowVideoButton;var v=M(e,["onCapture","isOffline","mode","validateText","resetText","isShowOffline","isShowVideoButton"]),w=r(null),y=r(null),A=r(new pr),C=o(u),E=C[0],b=C[1],x=o(!1),B=x[0],I=x[1],q=o(!1),R=q[0],N=q[1],j=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||navigator.maxTouchPoints>0||"ontouchstart"in document.documentElement,G=function(){var e=r(null),t=o(0),a=t[0],s=t[1],c=function(e){var t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),o=e%60;return"".concat(t>0?t.toString().padStart(2,"0").concat(":"):"").concat(r>0?r.toString().padStart(2,"0").concat(":"):"").concat(n.toString().padStart(2,"0"),":").concat(o.toString().padStart(2,"0"))},l=n((function(){return c(a)}),[a]),u=i((function(){s(0),e.current=setInterval((function(){s((function(e){return e+1}))}),1e3)}),[]),d=i((function(){e.current&&(clearInterval(e.current),e.current=null)}),[]);return{formatTime:c,startTimer:u,stopTimer:d,formatedTime:l}}(),S=G.formatedTime,V=G.startTimer,Y=G.stopTimer,O=o({imageUrl:null,videoUrl:null,isRecording:!1,storedFileId:null,file:null}),P=O[0],L=O[1],Q=o({facingMode:"environment",width:{min:200},height:{min:300}});Q[0];var U=Q[1];a((function(){return U({facingMode:j?"environment":"user",width:{min:200},height:{min:300}}),function(){J(),Y(),Z()}}),[]),a((function(){"video"===E&&I(!1)}),[P]);var W=i((function(){return D(void 0,void 0,void 0,(function(){var e,t,r,n,o,i,a,s,c,l;return F(this,(function(u){if(e=null===(l=w.current)||void 0===l?void 0:l.getScreenshot()){for(t=atob(e.split(",")[1]),r=new Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);o=new Uint8Array(r),i=new Blob([o],{type:"image/jpeg"}),a="captured_image_".concat(Date.now().toString().slice(-7),".jpg"),s=new File([i],a,{type:"image/jpeg"}),c=URL.createObjectURL(s),L((function(e){return T(T({},e),{imageUrl:c,file:s})}))}return[2]}))}))}),[w,c,t]),K=i((function(){if(w.current&&w.current.stream){var e="webm",t="video/".concat(e);MediaRecorder.isTypeSupported("video/mp4")&&(e="mp4",t="video/mp4");var r=new MediaRecorder(w.current.stream,{mimeType:t}),n=[];r.ondataavailable=function(e){e.data.size>0&&n.push(e.data)},r.onstop=function(){return D(void 0,void 0,void 0,(function(){var r,o,i,a;return F(this,(function(s){return r=new Blob(n,{type:t}),o="captured_video_".concat(Date.now(),".").concat(e),i=new File([r],o,{type:t}),a=URL.createObjectURL(i),L((function(e){return T(T({},e),{videoUrl:a,isRecording:!1,file:i})})),Y(),[2]}))}))},r.start(),y.current=r,V(),L((function(e){return T(T({},e),{isRecording:!0})}))}}),[w,c,V,Y,t]),J=function(){L({imageUrl:null,videoUrl:null,isRecording:!1,storedFileId:null,file:null})};return k.exports.jsx("div",T({className:"camera-container"},{children:P.imageUrl||P.videoUrl?k.exports.jsxs("div",T({className:"camera-preview camera-screen-animation"},{children:[P.imageUrl&&k.exports.jsx("img",{src:P.imageUrl,alt:"Capturé",style:{height:"90%",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center"}}),P.videoUrl&&k.exports.jsxs("video",T({width:"100%",height:"90%",id:"video",style:{height:"90%",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center"},onEnded:function(){return I(!1)}},{children:[k.exports.jsx("source",{src:P.videoUrl,type:"video/mp4"}),k.exports.jsx("source",{src:P.videoUrl,type:"video/webm"}),k.exports.jsx("track",{kind:"captions",src:"",lang:"en",label:"English",default:!0}),"Your browser does not support the video."]})),P.videoUrl&&k.exports.jsx(le,T({variant:"contained",className:"video-play-btn",onClick:function(){var e=document.getElementById("video");try{e.paused?e.play():e.pause(),I(!B)}catch(e){}}},{children:B?k.exports.jsx(sr,{}):k.exports.jsx(cr,{})})),k.exports.jsxs("div",T({className:"camera-controls"},{children:[k.exports.jsx(le,T({variant:"contained",onClick:function(){return D(void 0,void 0,void 0,(function(){var e;return F(this,(function(r){switch(r.label){case 0:return c?[4,A.current.storeFile(P.file)]:[3,2];case 1:e=r.sent(),t({fileRowId:e,fileStoreName:"capturedFiles"}),r.label=2;case 2:return c||"photo"!==E||t({file:P.file,imageSrc:P.imageUrl}),c||"video"!==E||t({file:P.file,videoSrc:P.videoUrl}),J(),[2]}}))}))},className:"camera-button camera-button--download"},{children:f})),k.exports.jsx(le,T({variant:"outlined",onClick:J,className:"camera-button camera-button--reset"},{children:h}))]}))]})):k.exports.jsxs("div",T({className:"camera-preview"},{children:[P.isRecording&&k.exports.jsxs("div",T({className:"camera-recording-timer",style:{display:"video"===E?"flex":"none"}},{children:[k.exports.jsx("span",{className:"camera-recording-dot"}),k.exports.jsx("span",{children:S})]})),!P.isRecording&&k.exports.jsx("button",T({type:"button",onClick:function(){return b("photo"===E?"video":"photo"),void J()},className:"camera-button camera-mode"},{children:k.exports.jsx("span",{children:"photo"===E?"Video":"Photo"})})),j&&!P.isRecording&&k.exports.jsx("button",T({type:"button",onClick:function(){N(!R),U({facingMode:R?"environment":"user",width:{min:200},height:{min:300}})},className:"camera-button camera-switch"},{children:k.exports.jsx(ur,{size:18})})),c&&m&&k.exports.jsx("div",T({className:"camera-offline-mode"},{children:"Offline mode"})),k.exports.jsx(Ht,T({ref:w,videoConstraints:{facingMode:"environment",width:{min:200},height:{min:300}}},v,{style:{height:"90% !important",objectFit:"contain",overflowClipMargin:"content-box",overflow:"clip",aspectRatio:"16/9",display:"flex",justifySelf:"center",margin:"0 auto"},screenshotFormat:"image/jpeg",allowFullScreen:!0})),k.exports.jsxs("div",T({className:"camera-controls"},{children:["photo"===E&&k.exports.jsx(le,T({variant:"contained",className:"camera-button camera-button--capture",onClick:W},{children:k.exports.jsx(ar,{size:28})})),"video"===E&&!P.isRecording&&k.exports.jsx(le,T({variant:"contained",onClick:K,className:"camera-button camera-button--record"},{children:k.exports.jsx(dr,{size:30})})),"video"===E&&P.isRecording&&k.exports.jsx(le,T({variant:"contained",onClick:Z,className:"camera-button camera-button--record"},{children:k.exports.jsx(lr,{size:28})}))]}))]}))}));function Z(){y.current&&y.current.stop()}},gr=function(e){var r=e.selected,n=e.value,o=e.size,i=e.children,a=e.className,s=e.onChange,c=t.useCallback((function(){s&&s(n)}),[s,n]);return k.exports.jsx("button",T({type:"button",className:U("ui-toggleBtn",void 0!==o?"ui-toggleBtn-size-".concat(o):"ui-toggleBtn-size-md",!0===r?"ui-toggleBtn-selected":null,a),onClick:c},{children:i}))};!function(e){e[e.Enter=0]="Enter",e[e.Entering=1]="Entering",e[e.Entered=2]="Entered",e[e.Exit=3]="Exit",e[e.Exiting=4]="Exiting",e[e.Exited=5]="Exited"}(fr||(fr={}));var mr=t.forwardRef((function(e,r){var n=e.trigger,o=e.mode,i=void 0===o?"appear":o,a=e.children,s=e.enterTimeout,c=e.exitTimeout,l=e.className,u=e.onEnter,d=e.onEntering,f=e.onEntered,p=e.onExit,h=e.onExiting,g=e.onExited,m=t.useRef(null),v=t.useRef(),w=t.useState((function(){return"appear"===i?fr.Exited:fr.Entered}));w[0],w[1],t.useEffect((function(){return function(){v.current&&window.clearTimeout(v.current)}}),[v]),t.useEffect((function(){n?(v.current&&window.clearTimeout(v.current),m.current.classList.remove("".concat(l,"-exit")),m.current.classList.remove("".concat(l,"-exiting")),m.current.classList.remove("".concat(l,"-exited")),u&&u(),m.current.classList.add("".concat(l,"-enter")),v.current=window.setTimeout((function(){d&&d(),m.current&&m.current.classList.add("".concat(l,"-entering")),v.current=window.setTimeout((function(){f&&f(),m.current&&m.current.classList.add("".concat(l,"-entered"))}),s||1e3)}),10)):(v.current&&window.clearTimeout(v.current),m.current.classList.remove("".concat(l,"-enter")),m.current.classList.remove("".concat(l,"-entering")),m.current.classList.remove("".concat(l,"-entered")),p&&p(),m.current.classList.add("".concat(l,"-exit")),v.current=window.setTimeout((function(){h&&h(),m.current&&m.current.classList.add("".concat(l,"-exiting")),v.current=window.setTimeout((function(){g&&g(),m.current&&m.current.classList.add("".concat(l,"-exited"))}),c||1e3)})))}),[n]);var y=t.useMemo((function(){if(a){var e=T(T({},a.props),{className:U(l,a.props.className),ref:m});return t.cloneElement(a,e)}}),[a,m]);return k.exports.jsx(k.exports.Fragment,{children:y})}));mr.propTypes={},mr.defaultProps={};var vr=t.forwardRef((function(e,t){var r=e.trigger,n=e.children,o=e.onEnter,i=e.onEntering,a=e.onEntered,s=e.onExit,c=e.onExiting,l=e.onExited;return k.exports.jsx(mr,T({ref:t,trigger:r,mode:"appear",className:"ui-fade",enterTimeout:160,exitTimeout:160,onEnter:o,onExit:s,onEntering:i,onEntered:a,onExiting:c,onExited:l},{children:n}))}));vr.propTypes={},vr.defaultProps={};var wr=function(e){var r=e.children,n=e.title;e.anchorEl;var o=e.enterDelay,i=void 0===o?0:o,a=e.leaveDelay,s=void 0===a?0:a,c=e.className,l=e.disabled,u=t.useState(void 0),d=u[0],f=u[1],p=t.useState(!1),h=p[0],g=p[1],m=t.useState(!0),v=m[0],w=m[1],y=t.useState(!1),A=y[0],C=y[1],E=t.useRef(),b=t.useRef();t.useEffect((function(){!0===l&&g(!1)}),[l]);var x,B=function(){g(!0)},M=function(){g(!1)},D=function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),b.current=setTimeout((function(){M()}),s))},F=function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),i)))},I=function(e){C(!0),clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),2e3))},q=function(e){clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),b.current=setTimeout((function(){M()}),3e3)};if(r){var R=T(T({},r.props),{onFocus:function(e){d||f(e.currentTarget),E.current=setTimeout((function(){B()}),i)},onMouseEnter:function(e){A||(clearTimeout(E.current),clearTimeout(b.current),d||f(e.currentTarget),!0!==l&&(E.current=setTimeout((function(){B()}),i)))},onMouseLeave:D,onMouseOver:F,onTouchStart:I,onTouchEnd:q});x=t.cloneElement(r,R)}var N=h||!v;return k.exports.jsxs(k.exports.Fragment,{children:[x,k.exports.jsx(ie,T({role:"tooltip",anchorEl:d,open:N,className:U("ui-tooltip",c),onMouseOver:A?void 0:F,onMouseLeave:A?void 0:D,onTouchStart:I,onTouchEnd:q},{children:k.exports.jsx(vr,T({trigger:h,onEnter:function(){w(!1)},onExited:function(){w(!0)}},{children:k.exports.jsx("div",T({className:"ui-tooltip-content"},{children:n}))}))}))]})};function yr(t,r){var n=e.useCallback((function(e){var n=e.target,o=r.reduce((function(e,t){if(!t)return e;var r=function(e){var t;if(!e)return document.body;if("[object String]"===Object.prototype.toString.call(e)){var r=document.getElementById(e);return null!=r?r:document.body}var n=e;return n&&void 0!==n.current?null!==(t=n.current)&&void 0!==t?t:void 0:e}(t);return!1!==e&&r&&null!==r?!r.contains(n):e}),!0);t&&o&&t()}),[t]);e.useEffect((function(){return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}),[r,n])}var Ar=function(e){var t=e.tag;e.className;var r=e.onDelete;return k.exports.jsxs("span",T({className:"ui-taginputItem"},{children:[k.exports.jsx("span",T({className:"ui-taginputItemLabel"},{children:t.label})),k.exports.jsx("button",T({type:"button",className:"ui-taginputItemRemove",onClick:r},{children:"x"}))]}))},Cr=t.forwardRef((function(e,r){var n=e.className,o=e.value,i=e.onClick,a=e.onChange,s=t.useRef(null),c=t.useCallback((function(e){a&&a(e.target.value)}),[a]);return t.useEffect((function(){if(r&&s)return Q(r,s.current),function(){Q(r,null)}}),[r,s]),k.exports.jsx(k.exports.Fragment,{children:k.exports.jsx("input",{ref:s,value:o,className:U("ui-taginputFilter",n),autoComplete:"off",spellCheck:"false","data-form-type":"other",onChange:c,onClick:i})})})),Er=function(e){var r=e.suggestion,n=e.onClick,o=t.useCallback((function(e){n&&n(r,e)}),[n]);return k.exports.jsx("div",T({role:"button",className:"ui-taginputSelectItem",tabIndex:0,onClick:o},{children:r.label}))},br=function(e){var t=e.group,r=e.onClick,n=Array.isArray(t.suggestions)?t.suggestions.map((function(e,t){return!0===e.group?k.exports.jsx(br,{group:e,onClick:r},t):k.exports.jsx(Er,{suggestion:e,onClick:r},t)})):null;return k.exports.jsxs("div",T({className:"ui-taginputSelectGroup"},{children:[k.exports.jsx("span",T({className:"ui-taginputSelectGroupLabel"},{children:t.label})),k.exports.jsx("div",T({className:"ui-taginputSelectGroupItems"},{children:n}))]}))},xr=t.forwardRef((function(e,r){var n=e.open,o=e.tags,i=e.disableFilter,a=e.suggestions,s=e.anchorEl,c=e.filter,l=e.onSuggestionClick,u=t.useMemo((function(){if(!Array.isArray(a))return[];if(i)return a;var e=Array.isArray(o)&&o.length>0,t=c&&c.length>0,r=[];return a.forEach((function(n){if(!0!==n.group)e&&o.some((function(e){return e.id===n.id}))||t&&n.label.toUpperCase().indexOf(c.toUpperCase())<0||r.push(T({},n));else if(Array.isArray(n.suggestions)){var i=T(T({},n),{suggestions:[]});n.suggestions.forEach((function(r){e&&o.some((function(e){return e.id===r.id}))||t&&r.label.toUpperCase().indexOf(c.toUpperCase())<0||i.suggestions.push(T({},r))})),i.suggestions.length>0&&r.push(i)}})),r}),[a,c,o]),d=t.useCallback((function(e){l&&l(e)}),[l]),f=n&&u.length>0,p=u.map((function(e,t){return!0===e.group?k.exports.jsx(br,{group:e,onClick:d},t):k.exports.jsx(Er,{suggestion:e,onClick:d},t)}));return k.exports.jsx(ie,T({ref:r,open:f,anchorEl:s,placement:H},{children:k.exports.jsx("div",T({className:"ui-taginputSelect"},{children:p}))}))})),Br=function(e){var r=e.tags;e.className;var n=e.suggestions,o=e.disableFilter,i=e.onTextChange,a=e.onChange,s=t.useRef(null),c=t.useRef(null),l=t.useRef(null),u=t.useState(""),d=u[0],f=u[1],p=t.useState(!1),h=p[0],g=p[1];yr((function(){g(!1)}),[s,c]);var m=t.useCallback((function(e){if(a&&Array.isArray(r)){var t=r.findIndex((function(t){return t.id===e.id}));if(!(t<0)){var n=I([],r,!0);n.splice(t,1),a(n)}}}),[r,a]),v=t.useCallback((function(e){if(e){var t={id:e.id,label:e.label,value:e.value},n=Array.isArray(r)?I(I([],r,!0),[t],!1):[t];g(!1),a&&a(n),f(""),i&&i("")}}),[r,a,i]),w=t.useCallback((function(e){f(e),i&&i(e)}),[i]),y=Array.isArray(r)?r.map((function(e,t){return k.exports.jsx(Ar,{tag:e,onDelete:function(){return m(e)}},t)})):[];return k.exports.jsxs("div",T({ref:l,className:"ui-taginput"},{children:[y,k.exports.jsx(Cr,{ref:s,value:d,onChange:w,onClick:function(){g(!0)}}),k.exports.jsx(xr,{ref:c,open:h,anchorEl:s,filter:d,tags:r,suggestions:n,disableFilter:o,onSuggestionClick:v})]}))};function Tr(e,t){return Object.freeze({...e,...t})}const Mr=c(null),Dr=Mr.Provider;function Fr(){const e=l(Mr);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function Ir(e){return u((function(r,n){const{instance:o,context:i}=e(r).current;return d(n,(()=>o)),null==r.children?null:t.createElement(Dr,{value:i},r.children)}))}function kr(e,t){const n=r();a((function(){return null!=t&&e.instance.on(t),n.current=t,function(){null!=n.current&&e.instance.off(n.current),n.current=null}}),[e,t])}function qr(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function Rr(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function Nr(e,t){return null==t?function(t,n){const o=r();return o.current||(o.current=e(t,n)),o}:function(n,o){const i=r();i.current||(i.current=e(n,o));const s=r(n),{instance:c}=i.current;return a((function(){s.current!==n&&(t(c,n,s.current),s.current=n)}),[c,n,o]),i}}function jr(e,t){a((function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){t.layerContainer?.removeLayer(e.instance),t.map.removeLayer(e.instance)}}),[t,e])}function Gr(e){return function(t){const n=Fr(),o=e(qr(t,n),n);return function(e,t){const n=r(t);a((function(){t!==n.current&&null!=e.attributionControl&&(null!=n.current&&e.attributionControl.removeAttribution(n.current),null!=t&&e.attributionControl.addAttribution(t)),n.current=t}),[e,t])}(n.map,t.attribution),kr(o.current,t.eventHandlers),jr(o.current,n),o}}function Sr(e,t){return Ir(function(e){return function(t){const n=Fr(),o=e(qr(t,n),n);return kr(o.current,t.eventHandlers),jr(o.current,n),function(e,t){const n=r();a((function(){if(t.pathOptions!==n.current){const r=t.pathOptions??{};e.instance.setStyle(r),n.current=r}}),[e,t])}(o.current,t),o}}(Nr(e,t)))}function Vr(){return Fr().map}const Yr=Sr((function({children:e,...t},r){const n=new m([],t);return Rr(n,Tr(r,{layerContainer:n,overlayContainer:n}))}));function Or(){return Or=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Or.apply(this,arguments)}const Pr=u((function({bounds:e,boundsOptions:r,center:n,children:s,className:c,id:l,placeholder:u,style:f,whenReady:p,zoom:h,...g},m){const[w]=o({className:c,id:l,style:f}),[y,A]=o(null);d(m,(()=>y?.map??null),[y]);const C=i((t=>{if(null!==t&&null===y){const o=new v(t,g);null!=n&&null!=h?o.setView(n,h):null!=e&&o.fitBounds(e,r),null!=p&&o.whenReady(p),A(function(e){return Object.freeze({__version:1,map:e})}(o))}}),[]);a((()=>()=>{y?.map.remove()}),[y]);const E=y?t.createElement(Dr,{value:y},s):u??null;return t.createElement("div",Or({},w,{ref:C}),E)})),Lr=Ir(Gr(Nr((function({position:e,...t},r){const n=new w(e,t);return Rr(n,Tr(r,{overlayContainer:n}))}),(function(e,t,r){t.position!==r.position&&e.setLatLng(t.position),null!=t.icon&&t.icon!==r.icon&&e.setIcon(t.icon),null!=t.zIndexOffset&&t.zIndexOffset!==r.zIndexOffset&&e.setZIndexOffset(t.zIndexOffset),null!=t.opacity&&t.opacity!==r.opacity&&e.setOpacity(t.opacity),null!=e.dragging&&t.draggable!==r.draggable&&(!0===t.draggable?e.dragging.enable():e.dragging.disable())})))),Qr=Sr((function({positions:e,...t},r){const n=new y(e,t);return Rr(n,Tr(r,{overlayContainer:n}))}),(function(e,t,r){t.positions!==r.positions&&e.setLatLngs(t.positions)})),Ur=function(e){return u((function(t,r){const{instance:n}=e(t).current;return d(r,(()=>n)),null}))}(Gr(Nr((function({url:e,...t},r){return Rr(new A(e,qr(t,r)),r)}),(function(e,t,r){!function(e,t,r){const{opacity:n,zIndex:o}=t;null!=n&&n!==r.opacity&&e.setOpacity(n),null!=o&&o!==r.zIndex&&e.setZIndex(o)}(e,t,r);const{url:n}=t;null!=n&&n!==r.url&&e.setUrl(n)}))));var Wr,Kr=c({locations:[],setLocations:function(){}});void 0===(Wr=window.leafletActiveAreaPreviousMethods)&&(Wr={getCenter:L.Map.prototype.getCenter,setView:L.Map.prototype.setView,flyTo:L.Map.prototype.flyTo,setZoomAround:L.Map.prototype.setZoomAround,getBoundsZoom:L.Map.prototype.getBoundsZoom,PopupAdjustPan:L.Popup.prototype._adjustPan,RendererUpdate:L.Renderer.prototype._update}),L.Map.include({getBounds:function(){if(this._viewport)return this.getViewportLatLngBounds();var e=this.getPixelBounds(),t=this.unproject(e.getBottomLeft()),r=this.unproject(e.getTopRight());return new L.LatLngBounds(t,r)},getViewport:function(){return this._viewport},getViewportBounds:function(){var e=this._viewport,t=L.point(e.offsetLeft,e.offsetTop),r=L.point(e.clientWidth,e.clientHeight);return 0!==r.x&&0!==r.y||(e=this.getContainer())&&(t=L.point(0,0),r=L.point(e.clientWidth,e.clientHeight)),L.bounds(t,t.add(r))},getViewportLatLngBounds:function(){var e=this.getViewportBounds();return L.latLngBounds(this.containerPointToLatLng(e.min),this.containerPointToLatLng(e.max))},getOffset:function(){var e=this.getSize().divideBy(2),t=this.getViewportBounds().getCenter();return e.subtract(t)},getCenter:function(e){var t=Wr.getCenter.call(this);if(this.getViewport()&&!e){var r=this.getZoom(),n=this.project(t,r);n=n.subtract(this.getOffset()),t=this.unproject(n,r)}return t},setView:function(e,t,r){if(e=L.latLng(e),t=void 0===t?this._zoom:this._limitZoom(t),this.getViewport()){var n=this.project(e,this._limitZoom(t));n=n.add(this.getOffset()),e=this.unproject(n,this._limitZoom(t))}return Wr.setView.call(this,e,t,r)},flyTo:function(e,t,r){if(e=L.latLng(e),t=void 0===t?s:t,this.getViewport()){var n=this.project(e,this._limitZoom(t));n=n.add(this.getOffset()),e=this.unproject(n,this._limitZoom(t))}if(!1===(r=r||{}).animate||!L.Browser.any3d)return this.setView(e,t,r);this._stop();var o=this.project(Wr.getCenter.call(this)),i=this.project(e),a=this.getSize(),s=this._zoom,c=Math.max(a.x,a.y),l=c*this.getZoomScale(s,t),u=i.distanceTo(o)||1,d=1.42,f=2.0164;function p(e){var t=(l*l-c*c+(e?-1:1)*f*f*u*u)/(2*(e?l:c)*f*u),r=Math.sqrt(t*t+1)-t;return r<1e-9?-18:Math.log(r)}function h(e){return(Math.exp(e)-Math.exp(-e))/2}function g(e){return(Math.exp(e)+Math.exp(-e))/2}var m=p(0);var v=Date.now(),w=(p(1)-m)/d,y=r.duration?1e3*r.duration:1e3*w*.8;return this._moveStart(!0,r.noMoveStart),function r(){var n=(Date.now()-v)/y,a=function(e){return 1-Math.pow(1-e,1.5)}(n)*w;n<=1?(this._flyToFrame=L.Util.requestAnimFrame(r,this),this._move(this.unproject(o.add(i.subtract(o).multiplyBy(function(e){return c*(g(m)*function(e){return h(e)/g(e)}(m+d*e)-h(m))/f}(a)/u)),s),this.getScaleZoom(c/function(e){return c*(g(m)/g(m+d*e))}(a),s),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}.call(this),this},setZoomAround:function(e,t,r){if(this.getViewport()){var n=this.getZoomScale(t),o=this.getViewportBounds().getCenter(),i=(e instanceof L.Point?e:this.latLngToContainerPoint(e)).subtract(o).multiplyBy(1-1/n),a=this.containerPointToLatLng(o.add(i));return this.setView(a,t,{zoom:r})}return Wr.setZoomAround.call(this,e,t,r)},getBoundsZoom:function(e,t,r){e=L.latLngBounds(e),r=L.point(r||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),i=this.getMaxZoom(),a=e.getNorthWest(),s=e.getSouthEast(),c=this.getViewport(),l=(c?L.point(c.clientWidth,c.clientHeight):this.getSize()).subtract(r),u=this.project(s,n).subtract(this.project(a,n)),d=L.Browser.any3d?this.options.zoomSnap:1,f=l.x/u.x,p=l.y/u.y,h=t?Math.max(f,p):Math.min(f,p);return n=this.getScaleZoom(h,n),d&&(n=Math.round(n/(d/100))*(d/100),n=t?Math.ceil(n/d)*d:Math.floor(n/d)*d),Math.max(o,Math.min(i,n))},setActiveArea:function(e,t,r){var n;if(t&&this._zoom&&(n=this.getCenter()),!this._viewport){var o=this.getContainer();this._viewport=L.DomUtil.create("div",""),o.insertBefore(this._viewport,o.firstChild)}return"string"==typeof e?this._viewport.className=e:L.extend(this._viewport.style,e),n&&this.setView(n,this.getZoom(),{animate:!!r}),this}}),L.Renderer.include({_onZoom:function(){this._updateTransform(this._map.getCenter(!0),this._map.getZoom())},_update:function(){Wr.RendererUpdate.call(this),this._center=this._map.getCenter(!0)}}),L.GridLayer.include({_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(void 0!==e){for(var r in this._levels)r=Number(r),this._levels[r].el.children.length||r===e?(this._levels[r].el.style.zIndex=t-Math.abs(e-r),this._onUpdateLevel(r)):(L.DomUtil.remove(this._levels[r].el),this._removeTilesAtZoom(r),this._onRemoveLevel(r),delete this._levels[r]);var n=this._levels[e],o=this._map;return n||((n=this._levels[e]={}).el=L.DomUtil.create("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=t,n.origin=o.project(o.unproject(o.getPixelOrigin()),e).round(),n.zoom=e,this._setZoomTransform(n,o.getCenter(!0),o.getZoom()),L.Util.falseFn(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(!0),this._map.getZoom(),t,t)},_update:function(e){var t=this._map;if(t){var r=this._clampZoom(t.getZoom());if(void 0===e&&(e=t.getCenter(!0)),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(e),o=this._pxBoundsToTileRange(n),i=o.getCenter(),a=[],s=this.options.keepBuffer,c=new L.Bounds(o.getBottomLeft().subtract([s,-s]),o.getTopRight().add([s,-s]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var l in this._tiles){var u=this._tiles[l].coords;u.z===this._tileZoom&&c.contains(new L.Point(u.x,u.y))||(this._tiles[l].current=!1)}if(Math.abs(r-this._tileZoom)>1)this._setView(e,r);else{for(var d=o.min.y;d<=o.max.y;d++)for(var f=o.min.x;f<=o.max.x;f++){var p=new L.Point(f,d);if(p.z=this._tileZoom,this._isValidTile(p)){var h=this._tiles[this._tileCoordsToKey(p)];h?h.current=!0:a.push(p)}}if(a.sort((function(e,t){return e.distanceTo(i)-t.distanceTo(i)})),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(f=0;f<a.length;f++)this._addTile(a[f],g);this._level.el.appendChild(g)}}}}}}),L.Popup.include({_adjustPan:function(){if(this._map._viewport){if(!this.options.autoPan)return;this._map._panAnim&&this._map._panAnim.stop();var e=this._map,t=e._viewport,r=this._container.offsetHeight,n=this._containerWidth,o=L.point(t.offsetLeft,t.offsetTop),i=new L.Point(this._containerLeft-o.x,-r-this._containerBottom-o.y);i._add(L.DomUtil.getPosition(this._container));var a=e.layerPointToContainerPoint(i),s=L.point(this.options.autoPanPadding),c=L.point(this.options.autoPanPaddingTopLeft||s),l=L.point(this.options.autoPanPaddingBottomRight||s),u=L.point(t.clientWidth,t.clientHeight),d=0,f=0;a.x+n+l.x>u.x&&(d=a.x+n-u.x+l.x),a.x-d-c.x<0&&(d=a.x-c.x),a.y+r+l.y>u.y&&(f=a.y+r-u.y+l.y),a.y-f-c.y<0&&(f=a.y-c.y),(d||f)&&e.fire("autopanstart").panBy([d,f])}else Wr.PopupAdjustPan.call(this)}});var Jr=function(e){var t=Vr();a((function(){t.setActiveArea("cortex-widget-viewport",!0,!0),g.Control.CenterActiveArea=g.Control.extend({onAdd:function(){var e;e=t.zoomControl&&!this.options.forceSeparateButton?t.zoomControl._container:g.DomUtil.create("div","leaflet-bar"),g.DomEvent.disableClickPropagation(e);var r=g.DomUtil.create("a","",e);return r.href="#",r.title="Centrer",r.innerHTML='\n <img src="'.concat(Zr,'" width="15px" style="margin-top: 7px; filter: brightness(0%)" />\n '),r.setAttribute("role","button"),r.setAttribute("aria-label",r.title),g.DomEvent.on(r,"click",g.DomEvent.stop).on(r,"click",s),e}}),g.control.centerActiveArea=function(e){return new g.Control.CenterActiveArea(e)},g.control.centerActiveArea({position:"topleft"}).addTo(t),e.autoCenter&&o()}),[]),a((function(){console.log(e.autoCenter),e.autoCenter&&o()}),[e.autoCenter]);var r=i((function(){var e=g.featureGroup();return t.eachLayer((function(t){t instanceof g.Marker&&e.addLayer(t)})),e}),[t]),n=i((function(){var e=g.featureGroup();return t.eachLayer((function(t){t instanceof g.Polygon&&e.addLayer(t)})),e}),[t]),o=i((function(){var e=r().getBounds();n().eachLayer((function(t){e.extend(t.getBounds())})),e.isValid()&&t.fitBounds(e,{animate:!0})}),[]),s=i((function(){o()}),[t]);return k.exports.jsx(k.exports.Fragment,{})},Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAABcRAAAXEQHKJvM/AAAAB3RJTUUH4wMIFTgXULHJFAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAhUlEQVRo3u3asQ2AIBAF0MO4p42FI1nYOKlugAUnJvL+BLzwcxGw7Md5RUO2dSmRkNZ1TPGTgICADAIptbGXNVqzUluraoGADAKZv/rIy56UqvVFartVVEu1QEBAQEBAQEBAQEAaz+xuGlXrpWr1PlvbERAQEJCIhzfEnqPYLxwgICBjQW7ewSYPr/zk7gAAAABJRU5ErkJggg==",Hr={exports:{}};
|
|
19
19
|
/*!
|
|
20
20
|
* Based on package 'screenfull'
|
|
21
21
|
* v5.2.0 - 2021-11-03
|