g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import { useState } from \"react\";\n\nfunction Square({ row, column, value, clickHandler }) {\n let buttonClass = \"\"\n switch (value){\n case \"X\":\n buttonClass = \"square bg-amber-200\t\"\n break;\n case \"O\":\n buttonClass = \"square bg-violet-300\"\n break;\n default:\n buttonClass = \"square bg-white\"\n break;\n }\n return (\n \n );\n}\n\nfunction SquareRow({ rowId, rows, clickHandler }) {\n const items =\n rows.map((ele, index) =>\n \n );\n\n return <>{items}>;\n}\n\nexport default function Map({ mapSize }) {\n // Config Here\n const ticTacToeMaxMapSize = 6\n\n if (mapSize == undefined) {\n mapSize = 3;\n }\n const [map, setMap] = useState(\n Array(mapSize).fill(null)\n .map(() => Array(mapSize).fill(null))\n );\n const [currentMove, setCurrentMove] = useState(0);\n const xIsNext = currentMove % 2 == 0;\n const [winner, setWinner] = useState(null);\n const [history, setHistory] = useState([Array(mapSize).fill(null)\n .map(() => Array(mapSize).fill(null))])\n\n function updateMap(nextMap) {\n setHistory([...history, nextMap])\n setMap(nextMap)\n }\n\n function handleClick(row, column) {\n if (map[row][column] != null || winner != null) {\n return\n }\n const nextMap = map.map(row => [...row]);\n if (xIsNext) {\n nextMap[row][column] = 'X'\n } else {\n nextMap[row][column] = 'O'\n }\n updateMap(nextMap)\n setCurrentMove(currentMove + 1)\n if (calculateWinner(row, column,nextMap)) {\n setWinner(nextMap[row][column])\n }\n }\n\n function calculateWinner(row, column,map) {\n const who = map[row][column]; // 当前玩家标记\n const winNeed = mapSize > ticTacToeMaxMapSize ? 5 : mapSize; // 棋盘大小(>5五子棋)\n\n // 横向检查\n let horizontal = 1;\n for (let hLeft = column - 1; hLeft >= 0; hLeft--) {\n if (map[row][hLeft] !== who) break;\n horizontal++;\n }\n for (let hRight = column + 1; hRight < mapSize; hRight++) {\n if (map[row][hRight] !== who) break;\n horizontal++;\n }\n if (horizontal >= winNeed) return true;\n\n // 纵向检查\n let vertical = 1;\n for (let vUp = row - 1; vUp >= 0; vUp--) {\n if (map[vUp][column] !== who) break;\n vertical++;\n }\n for (let vDown = row + 1; vDown < mapSize; vDown++) {\n if (map[vDown][column] !== who) break;\n vertical++;\n }\n if (vertical >= winNeed) return true;\n\n // 主对角线 (左上到右下)\n let mainDiagonal = 1;\n for (let dUp = 1; row - dUp >= 0 && column - dUp >= 0; dUp++) {\n if (map[row - dUp][column - dUp] !== who) break;\n mainDiagonal++;\n }\n for (let dDown = 1; row + dDown < mapSize && column + dDown < mapSize; dDown++) {\n if (map[row + dDown][column + dDown] !== who) break;\n mainDiagonal++;\n }\n if (mainDiagonal >= winNeed) return true;\n\n // 副对角线 (右上到左下)\n let antiDiagonal = 1;\n for (let dUp = 1; row - dUp >= 0 && column + dUp < mapSize; dUp++) {\n if (map[row - dUp][column + dUp] !== who) break;\n antiDiagonal++;\n }\n for (let dDown = 1; row + dDown < mapSize && column - dDown >= 0; dDown++) {\n if (map[row + dDown][column - dDown] !== who) break;\n antiDiagonal++;\n }\n if (antiDiagonal >= winNeed) return true;\n\n // 如果没有满足条件,返回 false\n return false;\n }\n\n const mapEle = map.map((ele, index) => (\n {/* Unique key for each row */}\n \n
\n ));\n\n function handleLeftClick() {\n if (currentMove > 0) {\n setMap(history[currentMove - 1]);\n setCurrentMove(currentMove - 1);\n setHistory(history.slice(0, -1));\n setWinner(null);\n }\n }\n\n return (\n \n
{mapSize > ticTacToeMaxMapSize ? \"五子棋\" : \"井字棋\"}模式
\n
现在是 {xIsNext ? \"X\" : \"O\"} 移动
\n
\n
\n \n
\n
{winner != null ? winner + \"赢了\" : \"\"}
\n
\n );\n}\n","import React, { StrictMode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport \"./styles.css\";\n\nimport App from \"./App\";\n\nconst root = createRoot(document.getElementById(\"root\"));\nroot.render(\n \n \n \n);"],"names":["aa","require","ca","p","a","b","c","arguments","length","encodeURIComponent","da","Set","ea","fa","ha","add","ia","window","document","createElement","ja","Object","prototype","hasOwnProperty","ka","la","ma","v","d","e","f","g","this","acceptsBooleans","attributeName","attributeNamespace","mustUseProperty","propertyName","type","sanitizeURL","removeEmptyString","z","split","forEach","toLowerCase","ra","sa","toUpperCase","ta","slice","pa","isNaN","qa","call","test","oa","removeAttribute","setAttribute","setAttributeNS","replace","xlinkHref","ua","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","va","Symbol","for","wa","ya","za","Aa","Ba","Ca","Da","Ea","Fa","Ga","Ha","Ia","Ja","iterator","Ka","La","A","assign","Ma","Error","stack","trim","match","Na","Oa","prepareStackTrace","defineProperty","set","Reflect","construct","l","h","k","displayName","includes","name","Pa","tag","render","Qa","$$typeof","_context","_payload","_init","Ra","Sa","Ta","nodeName","Va","_valueTracker","getOwnPropertyDescriptor","constructor","get","configurable","enumerable","getValue","setValue","stopTracking","Ua","Wa","checked","value","Xa","activeElement","body","Ya","defaultChecked","defaultValue","_wrapperState","initialChecked","Za","initialValue","controlled","ab","bb","cb","db","ownerDocument","eb","Array","isArray","fb","options","selected","defaultSelected","disabled","gb","dangerouslySetInnerHTML","children","hb","ib","jb","textContent","kb","lb","mb","nb","namespaceURI","innerHTML","valueOf","toString","firstChild","removeChild","appendChild","MSApp","execUnsafeLocalFunction","ob","lastChild","nodeType","nodeValue","pb","animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","qb","rb","sb","style","indexOf","setProperty","keys","charAt","substring","tb","menuitem","area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","ub","vb","is","wb","xb","target","srcElement","correspondingUseElement","parentNode","yb","zb","Ab","Bb","Cb","stateNode","Db","Eb","push","Fb","Gb","Hb","Ib","Jb","Kb","Lb","Mb","addEventListener","removeEventListener","Nb","apply","m","onError","Ob","Pb","Qb","Rb","Sb","Tb","Vb","alternate","return","flags","Wb","memoizedState","dehydrated","Xb","Zb","child","sibling","current","Yb","$b","ac","unstable_scheduleCallback","bc","unstable_cancelCallback","cc","unstable_shouldYield","dc","unstable_requestPaint","B","unstable_now","ec","unstable_getCurrentPriorityLevel","fc","unstable_ImmediatePriority","gc","unstable_UserBlockingPriority","hc","unstable_NormalPriority","ic","unstable_LowPriority","jc","unstable_IdlePriority","kc","lc","oc","Math","clz32","pc","qc","log","LN2","rc","sc","tc","uc","pendingLanes","suspendedLanes","pingedLanes","entangledLanes","entanglements","vc","xc","yc","zc","Ac","eventTimes","Cc","C","Dc","Ec","Fc","Gc","Hc","Ic","Jc","Kc","Lc","Mc","Nc","Oc","Map","Pc","Qc","Rc","Sc","delete","pointerId","Tc","nativeEvent","blockedOn","domEventName","eventSystemFlags","targetContainers","Vc","Wc","priority","isDehydrated","containerInfo","Xc","Yc","dispatchEvent","shift","Zc","$c","ad","bd","cd","ReactCurrentBatchConfig","dd","ed","transition","fd","gd","hd","id","Uc","stopPropagation","jd","kd","ld","md","nd","od","keyCode","charCode","pd","qd","rd","_reactName","_targetInst","currentTarget","isDefaultPrevented","defaultPrevented","returnValue","isPropagationStopped","preventDefault","cancelBubble","persist","isPersistent","wd","xd","yd","sd","eventPhase","bubbles","cancelable","timeStamp","Date","now","isTrusted","td","ud","view","detail","vd","Ad","screenX","screenY","clientX","clientY","pageX","pageY","ctrlKey","shiftKey","altKey","metaKey","getModifierState","zd","button","buttons","relatedTarget","fromElement","toElement","movementX","movementY","Bd","Dd","dataTransfer","Fd","Hd","animationName","elapsedTime","pseudoElement","Id","clipboardData","Jd","Ld","data","Md","Esc","Spacebar","Left","Up","Right","Down","Del","Win","Menu","Apps","Scroll","MozPrintableKey","Nd","Od","Alt","Control","Meta","Shift","Pd","Qd","key","String","fromCharCode","code","location","repeat","locale","which","Rd","Td","width","height","pressure","tangentialPressure","tiltX","tiltY","twist","pointerType","isPrimary","Vd","touches","targetTouches","changedTouches","Xd","Yd","deltaX","wheelDeltaX","deltaY","wheelDeltaY","wheelDelta","deltaZ","deltaMode","Zd","$d","ae","be","documentMode","ce","de","ee","fe","ge","he","ie","le","color","date","datetime","email","month","number","password","range","search","tel","text","time","url","week","me","ne","oe","event","listeners","pe","qe","re","se","te","ue","ve","we","xe","ye","ze","oninput","Ae","detachEvent","Be","Ce","attachEvent","De","Ee","Fe","He","Ie","Je","Ke","node","offset","nextSibling","Le","contains","compareDocumentPosition","Me","HTMLIFrameElement","contentWindow","href","Ne","contentEditable","Oe","focusedElem","selectionRange","documentElement","start","end","selectionStart","selectionEnd","min","defaultView","getSelection","extend","rangeCount","anchorNode","anchorOffset","focusNode","focusOffset","createRange","setStart","removeAllRanges","addRange","setEnd","element","left","scrollLeft","top","scrollTop","focus","Pe","Qe","Re","Se","Te","Ue","Ve","We","animationend","animationiteration","animationstart","transitionend","Xe","Ye","Ze","animation","$e","af","bf","cf","df","ef","ff","gf","hf","lf","mf","concat","nf","Ub","instance","listener","D","of","has","pf","qf","rf","random","sf","bind","capture","passive","n","t","J","x","u","w","F","tf","uf","parentWindow","vf","wf","na","xa","$a","ba","je","char","ke","unshift","xf","yf","zf","Af","Bf","Cf","Df","Ef","__html","Ff","setTimeout","Gf","clearTimeout","Hf","Promise","Jf","queueMicrotask","resolve","then","catch","If","Kf","Lf","Mf","previousSibling","Nf","Of","Pf","Qf","Rf","Sf","Tf","Uf","E","G","Vf","H","Wf","Xf","Yf","contextTypes","__reactInternalMemoizedUnmaskedChildContext","__reactInternalMemoizedMaskedChildContext","Zf","childContextTypes","$f","ag","bg","getChildContext","cg","__reactInternalMemoizedMergedChildContext","dg","eg","fg","gg","hg","jg","kg","lg","mg","ng","og","pg","qg","rg","sg","tg","ug","vg","wg","xg","yg","I","zg","Ag","Bg","elementType","deletions","Cg","pendingProps","overflow","treeContext","retryLane","Dg","mode","Eg","Fg","Gg","memoizedProps","Hg","Ig","Jg","Kg","Lg","ref","_owner","_stringRef","refs","Mg","join","Ng","Og","index","Pg","Qg","props","Rg","implementation","Sg","Tg","q","r","y","next","done","Ug","Vg","Wg","Xg","Yg","Zg","$g","ah","_currentValue","bh","childLanes","ch","dependencies","firstContext","lanes","dh","eh","context","memoizedValue","fh","gh","hh","interleaved","ih","jh","kh","updateQueue","baseState","firstBaseUpdate","lastBaseUpdate","shared","pending","effects","lh","mh","eventTime","lane","payload","callback","nh","K","oh","ph","qh","rh","sh","th","uh","vh","wh","xh","yh","tagName","zh","Ah","Bh","L","Ch","revealOrder","Dh","Eh","_workInProgressVersionPrimary","Fh","ReactCurrentDispatcher","Gh","Hh","M","N","O","Ih","Jh","Kh","Lh","P","Mh","Nh","Oh","Ph","Qh","Rh","Sh","Th","baseQueue","queue","Uh","Vh","Wh","lastRenderedReducer","action","hasEagerState","eagerState","lastRenderedState","dispatch","Xh","Yh","Zh","$h","ai","getSnapshot","bi","ci","Q","di","lastEffect","stores","ei","fi","gi","hi","ii","create","destroy","deps","ji","ki","li","mi","ni","oi","pi","qi","ri","si","ti","ui","vi","wi","xi","yi","zi","Ai","R","Bi","readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","identifierPrefix","Ci","defaultProps","Di","Ei","isMounted","_reactInternals","enqueueSetState","enqueueReplaceState","enqueueForceUpdate","Fi","shouldComponentUpdate","isPureReactComponent","Gi","contextType","state","updater","Hi","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","Ii","getDerivedStateFromProps","getSnapshotBeforeUpdate","UNSAFE_componentWillMount","componentWillMount","componentDidMount","Ji","message","digest","Ki","Li","console","error","Mi","WeakMap","Ni","Oi","Pi","Qi","getDerivedStateFromError","componentDidCatch","Ri","componentStack","Si","pingCache","Ti","Ui","Vi","Wi","ReactCurrentOwner","Xi","Yi","Zi","$i","aj","compare","bj","cj","dj","baseLanes","cachePool","transitions","ej","fj","gj","hj","ij","UNSAFE_componentWillUpdate","componentWillUpdate","componentDidUpdate","jj","kj","pendingContext","lj","zj","Aj","Bj","Cj","mj","nj","oj","fallback","pj","qj","sj","dataset","dgst","tj","uj","_reactRetry","rj","subtreeFlags","vj","wj","isBackwards","rendering","renderingStartTime","last","tail","tailMode","xj","Dj","S","Ej","Fj","wasMultiple","multiple","suppressHydrationWarning","onClick","onclick","size","createElementNS","autoFocus","createTextNode","T","Gj","Hj","Ij","Jj","U","Kj","WeakSet","V","Lj","W","Mj","Nj","Pj","Qj","Rj","Sj","Tj","Uj","Vj","insertBefore","_reactRootContainer","Wj","X","Xj","Yj","Zj","onCommitFiberUnmount","componentWillUnmount","ak","bk","ck","dk","ek","isHidden","fk","gk","display","hk","ik","jk","kk","__reactInternalSnapshotBeforeUpdate","src","Vk","lk","ceil","mk","nk","ok","Y","Z","pk","qk","rk","sk","tk","Infinity","uk","vk","wk","xk","yk","zk","Ak","Bk","Ck","Dk","callbackNode","expirationTimes","expiredLanes","wc","callbackPriority","ig","Ek","Fk","Gk","Hk","Ik","Jk","Kk","Lk","Mk","Nk","Ok","finishedWork","finishedLanes","Pk","timeoutHandle","Qk","Rk","Sk","Tk","Uk","mutableReadLanes","Bc","Oj","onCommitFiberRoot","mc","onRecoverableError","Wk","onPostCommitFiberRoot","Xk","Yk","$k","isReactComponent","pendingChildren","al","mutableSourceEagerHydrationData","bl","cache","pendingSuspenseBoundaries","dl","el","fl","gl","hl","il","yj","Zk","kl","reportError","ll","_internalRoot","ml","nl","ol","pl","rl","ql","unmount","unstable_scheduleHydration","splice","querySelectorAll","JSON","stringify","form","sl","usingClientEntryPoint","Events","tl","findFiberByHostInstance","bundleType","version","rendererPackageName","ul","rendererConfig","overrideHookState","overrideHookStateDeletePath","overrideHookStateRenamePath","overrideProps","overridePropsDeletePath","overridePropsRenamePath","setErrorHandler","setSuspenseHandler","scheduleUpdate","currentDispatcherRef","findHostInstanceByFiber","findHostInstancesForRefresh","scheduleRefresh","scheduleRoot","setRefreshHandler","getCurrentFiber","reconcilerVersion","__REACT_DEVTOOLS_GLOBAL_HOOK__","vl","isDisabled","supportsFiber","inject","exports","createPortal","cl","createRoot","unstable_strictMode","findDOMNode","flushSync","hydrate","hydrateRoot","hydratedSources","_getVersion","_source","unmountComponentAtNode","unstable_batchedUpdates","unstable_renderSubtreeIntoContainer","checkDCE","err","module","__self","__source","Fragment","jsx","jsxs","setState","forceUpdate","escape","_status","_result","default","Children","map","count","toArray","only","Component","Profiler","PureComponent","StrictMode","Suspense","act","cloneElement","createContext","_currentValue2","_threadCount","Provider","Consumer","_defaultValue","_globalName","createFactory","createRef","forwardRef","isValidElement","lazy","memo","startTransition","unstable_act","pop","sortIndex","performance","setImmediate","startTime","expirationTime","priorityLevel","navigator","scheduling","isInputPending","MessageChannel","port2","port1","onmessage","postMessage","unstable_Profiling","unstable_continueExecution","unstable_forceFrameRate","floor","unstable_getFirstCallbackNode","unstable_next","unstable_pauseExecution","unstable_runWithPriority","delay","unstable_wrapCallback","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","Square","_ref","row","column","clickHandler","buttonClass","_jsx","className","SquareRow","_ref2","rowId","rows","items","ele","_Fragment","_ref3","mapSize","setMap","fill","currentMove","setCurrentMove","xIsNext","winner","setWinner","history","setHistory","handleClick","nextMap","updateMap","who","winNeed","horizontal","hLeft","hRight","vertical","vUp","vDown","mainDiagonal","dUp","dDown","antiDiagonal","calculateWinner","mapEle","_jsxs","getElementById","App"],"sourceRoot":""}
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..959dc1d
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,16 @@
+version: '3.8'
+
+services:
+ app:
+ image: node:23-alpine
+ container_name: learn-react
+ working_dir: /root/ReactLearn
+ volumes:
+ - ./app:/root/ReactLearn
+ ports:
+ - "58701:4000"
+ command: sh -c "apk add --no-cache yarn && yarn install && yarn build && yarn global add serve && serve -s build -l 4000"
+
+volumes:
+ app:
+ driver: local