← Back
Editing: 648.min.js
"use strict";(self.webpackChunkpost_expirator=self.webpackChunkpost_expirator||[]).push([[648],{2017(e){e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!==i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!==i--;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},9648(e,t,r){r.r(t),r.d(t,{DndContext:()=>i,DndProvider:()=>he,DragPreviewImage:()=>ye,useDrag:()=>_e,useDragDropManager:()=>Re,useDragLayer:()=>Ae,useDrop:()=>Be});var n=r(1594);const i=(0,n.createContext)({dragDropManager:void 0});var o=r(4848);function s(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var c="function"==typeof Symbol&&Symbol.observable||"@@observable",a=function(){return Math.random().toString(36).substring(7).split("").join(".")},u={INIT:"@@redux/INIT"+a(),REPLACE:"@@redux/REPLACE"+a(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+a()}};function d(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(s(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(s(1));return r(d)(e,t)}if("function"!=typeof e)throw new Error(s(2));var i=e,o=t,a=[],l=a,g=!1;function f(){l===a&&(l=a.slice())}function h(){if(g)throw new Error(s(3));return o}function p(e){if("function"!=typeof e)throw new Error(s(4));if(g)throw new Error(s(5));var t=!0;return f(),l.push(e),function(){if(t){if(g)throw new Error(s(6));t=!1,f();var r=l.indexOf(e);l.splice(r,1),a=null}}}function y(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(s(7));if(void 0===e.type)throw new Error(s(8));if(g)throw new Error(s(9));try{g=!0,o=i(o,e)}finally{g=!1}for(var t=a=l,r=0;r<t.length;r++)(0,t[r])();return e}return y({type:u.INIT}),(n={dispatch:y,subscribe:p,getState:h,replaceReducer:function(e){if("function"!=typeof e)throw new Error(s(10));i=e,y({type:u.REPLACE})}})[c]=function(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(s(11));function r(){e.next&&e.next(h())}return r(),{unsubscribe:t(r)}}})[c]=function(){return this},e},n}function l(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,function(){return r[n++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}function g(e){return"object"==typeof e}const f="dnd-core/INIT_COORDS",h="dnd-core/BEGIN_DRAG",p="dnd-core/PUBLISH_DRAG_SOURCE",y="dnd-core/HOVER",O="dnd-core/DROP",b="dnd-core/END_DRAG";function S(e,t){return{type:f,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const I={type:f,payload:{clientOffset:null,sourceClientOffset:null}};function D(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:i,getSourceClientOffset:o}=r,s=e.getMonitor(),c=e.getRegistry();e.dispatch(S(i)),function(e,t,r){l(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){l(r.getSource(e),"Expected sourceIds to be registered.")})}(t,s,c);const a=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,s);if(null==a)return void e.dispatch(I);let u=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");!function(e){l("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(o),u=o(a)}e.dispatch(S(i,u));const d=c.getSource(a).beginDrag(s,a);if(null==d)return;!function(e){l(g(e),"Item must be an object.")}(d),c.pinSource(a);const f=c.getSourceType(a);return{type:h,payload:{itemType:f,item:d,sourceId:a,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!n}}}}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){v(e,t,r[t])})}return e}function m(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){l(e.isDragging(),"Cannot call drop while not dragging."),l(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const i=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);i.forEach((i,o)=>{const s=function(e,t,r,n){const i=r.getTarget(e);let o=i?i.drop(n,e):void 0;return function(e){l(void 0===e||g(e),"Drop result must either be an object or undefined.")}(o),void 0===o&&(o=0===t?{}:n.getDropResult()),o}(i,o,n,r),c={type:O,payload:{dropResult:w({},t,s)}};e.dispatch(c)})}}function T(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){l(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:b}}}function C(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function E(e){return function(t,{clientOffset:r}={}){!function(e){l(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),i=e.getMonitor(),o=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const i=e[n];C(t.getTargetType(i),r)||e.splice(n,1)}}(n,o,i.getItemType()),function(e,t,r){l(t.isDragging(),"Cannot call hover while not dragging."),l(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];l(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array."),l(r.getTarget(n),"Expected targetIds to be registered.")}}(n,i,o),function(e,t,r){e.forEach(function(e){r.getTarget(e).hover(t,e)})}(n,i,o),{type:y,payload:{targetIds:n,clientOffset:r||null}}}}function P(e){return function(){if(e.getMonitor().isDragging())return{type:p}}}class R{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store,r=function(e){return{beginDrag:D(e),publishDragSource:P(e),hover:E(e),drop:m(e),endDrag:T(e)}}(this);return Object.keys(r).reduce((n,i)=>{const o=r[i];var s;return n[i]=(s=o,(...r)=>{const n=s.apply(e,r);void 0!==n&&t(n)}),n},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function M(e,t){return{x:e.x-t.x,y:e.y-t.y}}const x=[],j=[];x.__IS_NONE__=!0,j.__IS_ALL__=!0;class k{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;l("function"==typeof e,"listener must be a function."),l(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe(()=>{const t=this.store.getState(),i=t.stateId;try{const o=i===n||i===n+1&&!function(e,t){return e!==x&&(e===j||void 0===t||(r=e,t.filter(e=>r.indexOf(e)>-1)).length>0);var r}(t.dirtyHandlerIds,r);o||e()}finally{n=i}})}subscribeToOffsetChange(e){l("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())})}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return l(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return l(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(C(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return l(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();if(i&&!C(n,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const s=o.indexOf(e);return r?s===o.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?M((o=n,{x:(i=t).x+o.x,y:i.y+o.y}),r):null;var i,o}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?M(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const _=void 0!==r.g?r.g:self,A=_.MutationObserver||_.WebKitMutationObserver;function N(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const H="function"==typeof A?function(e){let t=1;const r=new A(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:N;class U{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const G=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=H(this.flush),this.requestErrorThrow=N(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},q=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new U(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(G.registerPendingError),B="dnd-core/ADD_SOURCE",L="dnd-core/ADD_TARGET",$="dnd-core/REMOVE_SOURCE",F="dnd-core/REMOVE_TARGET";function V(e,t){t&&Array.isArray(e)?e.forEach(e=>V(e,!1)):l("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var W;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(W||(W={}));let Y=0;function K(e){switch(e[0]){case"S":return W.SOURCE;case"T":return W.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function X(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,i]}=r.next();if(i===t)return!0;n=!!e}while(!n);return!1}class z{addSource(e,t){V(e),function(e){l("function"==typeof e.canDrag,"Expected canDrag to be a function."),l("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),l("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(W.SOURCE,e,t);return this.store.dispatch(function(e){return{type:B,payload:{sourceId:e}}}(r)),r}addTarget(e,t){V(e,!0),function(e){l("function"==typeof e.canDrop,"Expected canDrop to be a function."),l("function"==typeof e.hover,"Expected hover to be a function."),l("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(W.TARGET,e,t);return this.store.dispatch(function(e){return{type:L,payload:{targetId:e}}}(r)),r}containsHandler(e){return X(this.dragSources,e)||X(this.dropTargets,e)}getSource(e,t=!1){return l(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return l(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return l(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return l(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return K(e)===W.SOURCE}isTargetId(e){return K(e)===W.TARGET}removeSource(e){var t;l(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:$,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},G.enqueueTask(q.create(t))}removeTarget(e){l(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:F,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);l(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){l(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(Y++).toString();switch(e){case W.SOURCE:return`S${t}`;case W.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===W.SOURCE?this.dragSources.set(n,r):e===W.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const J=(e,t)=>e===t;function Q(e=x,t){switch(t.type){case y:break;case B:case L:case F:case $:return x;default:return j}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,i=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const i=[];return r.forEach((e,t)=>{1===e&&i.push(t)}),i}(r,n);if(!(i.length>0)&&function(e,t,r=J){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n))return x;const o=n[n.length-1],s=r[r.length-1];return o!==s&&(o&&i.push(o),s&&i.push(s)),i}function Z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ee={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function te(e=ee,t){const{payload:r}=t;switch(t.type){case f:case h:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case y:return n=e.clientOffset,i=r.clientOffset,!n&&!i||n&&i&&n.x===i.x&&n.y===i.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){Z(e,t,r[t])})}return e}({},e,{clientOffset:r.clientOffset});case b:case O:return ee;default:return e}var n,i}function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){re(e,t,r[t])})}return e}const ie={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function oe(e=ie,t){const{payload:r}=t;switch(t.type){case h:return ne({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case p:return ne({},e,{isSourcePublic:!0});case y:return ne({},e,{targetIds:r.targetIds});case F:return-1===e.targetIds.indexOf(r.targetId)?e:ne({},e,{targetIds:(n=e.targetIds,i=r.targetId,n.filter(e=>e!==i))});case O:return ne({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case b:return ne({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,i}function se(e=0,t){switch(t.type){case B:case L:return e+1;case $:case F:return e-1;default:return e}}function ce(e=0){return e+1}function ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){ae(e,t,r[t])})}return e}function de(e={},t){return{dirtyHandlerIds:Q(e.dirtyHandlerIds,{type:t.type,payload:ue({},t.payload,{prevTargetIds:(r=e,n=[],"dragOperation.targetIds".split(".").reduce((e,t)=>e&&e[t]?e[t]:n||null,r))})}),dragOffset:te(e.dragOffset,t),refCount:se(e.refCount,t),dragOperation:oe(e.dragOperation,t),stateId:ce(e.stateId)};var r,n}function le(e,t=void 0,r={},n=!1){const i=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return d(de,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),o=new k(i,new z(i)),s=new R(i,o),c=e(s,t,r);return s.receiveBackend(c),s}let ge=0;const fe=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var he=(0,n.memo)(function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,["children"]);const[s,c]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=pe(),r,n){const i=t;return i[fe]||(i[fe]={dragDropManager:le(e,t,r,n)}),i[fe]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,n.useEffect)(()=>{if(c){const e=pe();return++ge,()=>{0===--ge&&(e[fe]=null)}}},[]),(0,o.jsx)(i.Provider,{value:s,children:t})});function pe(){return void 0!==r.g?r.g:window}const ye=(0,n.memo)(function({connect:e,src:t}){return(0,n.useEffect)(()=>{if("undefined"==typeof Image)return;let r=!1;const n=new Image;return n.src=t,n.onload=()=>{e(n),r=!0},()=>{r&&e(null)}}),null});var Oe=r(2017);const be="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Se(e,t,r){const[i,o]=(0,n.useState)(()=>t(e)),s=(0,n.useCallback)(()=>{const n=t(e);Oe(i,n)||(o(n),r&&r())},[i,e,r]);return be(s),[i,s]}function Ie(e,t,r){return function(e,t){const[n,i]=Se(e,t,()=>r.reconnect());return be(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),n}(t,e||(()=>({})))}function De(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,n.useMemo)(()=>"function"==typeof e?e():e,r)}function ve(e){return(0,n.useMemo)(()=>e.hooks.dragSource(),[e])}function we(e){return(0,n.useMemo)(()=>e.hooks.dragPreview(),[e])}function me(e,t,r,n){let i=r?r.call(n,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;const c=Object.prototype.hasOwnProperty.bind(t);for(let s=0;s<o.length;s++){const a=o[s];if(!c(a))return!1;const u=e[a],d=t[a];if(i=r?r.call(n,u,d,a):void 0,!1===i||void 0===i&&u!==d)return!1}return!0}function Te(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Ce(e){const t={};return Object.keys(e).forEach(r=>{const i=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,n.isValidElement)(t)){const n=t;return e(n,r),n}const i=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(i),function(e,t){const r=e.ref;return l("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,n.cloneElement)(e,{ref:e=>{Ee(r,e),Ee(t,e)}}):(0,n.cloneElement)(e,{ref:t})}(i,r?t=>e(t,r):e)}}(i);t[r]=()=>e}}),t}function Ee(e,t){"function"==typeof e?e(t):e.current=t}class Pe{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!me(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!me(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Ce({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Te(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Te(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}function Re(){const{dragDropManager:e}=(0,n.useContext)(i);return l(null!=e,"Expected drag drop context"),e}let Me=!1,xe=!1;class je{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){l(!Me,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Me=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Me=!1}}isDragging(){if(!this.sourceId)return!1;l(!xe,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return xe=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{xe=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class ke{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:i}=r;return i?i(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function _e(e,t){const r=De(e,t);l(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const i=function(){const e=Re();return(0,n.useMemo)(()=>new je(e),[e])}(),o=function(e,t){const r=Re(),i=(0,n.useMemo)(()=>new Pe(r.getBackend()),[r]);return be(()=>(i.dragSourceOptions=e||null,i.reconnect(),()=>i.disconnectDragSource()),[i,e]),be(()=>(i.dragPreviewOptions=t||null,i.reconnect(),()=>i.disconnectDragPreview()),[i,t]),i}(r.options,r.previewOptions);return function(e,t,r){const i=Re(),o=function(e,t,r){const i=(0,n.useMemo)(()=>new ke(e,t,r),[t,r]);return(0,n.useEffect)(()=>{i.spec=e},[e]),i}(e,t,r),s=function(e){return(0,n.useMemo)(()=>{const t=e.type;return l(null!=t,"spec.type must be defined"),t},[e])}(e);be(function(){if(null!=s){const[e,n]=function(e,t,r){const n=r.getRegistry(),i=n.addSource(e,t);return[i,()=>n.removeSource(i)]}(s,o,i);return t.receiveHandlerId(e),r.receiveHandlerId(e),n}},[i,t,r,o,s])}(r,i,o),[Ie(r.collect,i,o),ve(o),we(o)]}function Ae(e){const t=Re().getMonitor(),[r,i]=Se(t,e);return(0,n.useEffect)(()=>t.subscribeToOffsetChange(i)),(0,n.useEffect)(()=>t.subscribeToStateChange(i)),r}function Ne(e){return(0,n.useMemo)(()=>e.hooks.dropTarget(),[e])}class He{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!me(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Ce({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Te(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}let Ue=!1;class Ge{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;l(!Ue,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Ue=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ue=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class qe{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function Be(e,t){const r=De(e,t),i=function(){const e=Re();return(0,n.useMemo)(()=>new Ge(e),[e])}(),o=function(e){const t=Re(),r=(0,n.useMemo)(()=>new He(t.getBackend()),[t]);return be(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}(r.options);return function(e,t,r){const i=Re(),o=function(e,t){const r=(0,n.useMemo)(()=>new qe(e,t),[t]);return(0,n.useEffect)(()=>{r.spec=e},[e]),r}(e,t),s=function(e){const{accept:t}=e;return(0,n.useMemo)(()=>(l(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);be(function(){const[e,n]=function(e,t,r){const n=r.getRegistry(),i=n.addTarget(e,t);return[i,()=>n.removeTarget(i)]}(s,o,i);return t.receiveHandlerId(e),r.receiveHandlerId(e),n},[i,t,o,r,s.map(e=>e.toString()).join("|")])}(r,i,o),[Ie(r.collect,i,o),Ne(o)]}}}]);
Save File
Cancel